/* ══════════════════════════════
   home-blocks.css
   Reusable block classes — usable on ANY page.
   Add a custom class to any Gutenberg block to opt into these styles.

   Sections will be added here as they're built:
   - cb-big_button     : large feature buttons with icon, title/subtitle, arrow
   - cb-quick-button   : smaller, lighter button variant (no icon bg, no arrow)
   - cb-info-card      : vertical info card (transparent bg)
   - cb-info-card-bg   : vertical info card (translucent bg + border)
   - cb-info-box       : horizontal info row (Columns block, dividers between)
   - cb-list           : list with teal check icons in soft circles
   - cb-illustration   : decorative calculator illustration, bottom-right
   - cb-padding        : utility — adds 20px padding to any block
   - cb-rounded        : utility — applies theme border-radius
   - cb-heading-center : heading with line+diamond decoration on both sides
   - cb-heading-left   : heading staying left, with line+diamond on the right
   ══════════════════════════════ */


/* ══════════════════════════════
   cb-illustration
   Decorative calculator illustration in the bottom-right corner.
   Apply to any container — the class also enforces position: relative.
   Hidden on mobile to keep small viewports uncluttered.
   ══════════════════════════════ */

.cb-illustration {
  position: relative;
  overflow: hidden;
}

.cb-illustration::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 120px;
  height: 100px;
  background-image: url("../illustrations/calculator.svg");
  background-repeat: no-repeat;
  background-position: bottom right;
  background-size: contain;
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
}

/* Lift content above the illustration */
.cb-illustration > * { position: relative; z-index: 1; }

/* Hide on mobile — illustration would crowd content */
@media (max-width: 768px) {
  .cb-illustration::after { display: none; }
}


/* ══════════════════════════════
   cb-list
   Apply to a List block (.wp-block-list).
   Replaces bullets with a teal check inside a soft circle.
   ══════════════════════════════ */

ul.wp-block-list.cb-list,
ol.wp-block-list.cb-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

ul.wp-block-list.cb-list li,
ol.wp-block-list.cb-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* Check icon — soft teal circle with a teal check inside */
ul.wp-block-list.cb-list li::before,
ol.wp-block-list.cb-list li::before {
  content: '';
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--accent-soft);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d9488' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}


/* ══════════════════════════════
   cb-padding
   Utility: adds 20px padding to any block.
   ══════════════════════════════ */

.cb-padding { padding: 20px; }

/* ══════════════════════════════
   cb-rounded
   Utility: applies the theme's standard border-radius.
   ══════════════════════════════ */

.cb-rounded { border-radius: var(--radius); }


/* ══════════════════════════════
   cb-info-box
   Apply to a Columns block (.wp-block-columns).
   Each child column becomes an inline icon+heading+text item with a
   subtle vertical divider between columns.
   Markup expected per column:
     <div class="wp-block-column">
       <figure class="wp-block-image"><img></figure>
       <hN>Title</hN>
       <p>Description</p>
     </div>
   ══════════════════════════════ */

.wp-block-columns.cb-info-box {
  background: #f4faf9;
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 15px 0px;
  gap: 0; /* dividers replace gaps */
}
body.theme-dark .wp-block-columns.cb-info-box {
  background: rgba(13,40,40,0.45);
}

.wp-block-columns.cb-info-box > .wp-block-column {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 14px;
  padding: 0px 18px;
  position: relative;
}

/* Vertical divider between columns (desktop) */
@media (min-width: 769px) {
  .wp-block-columns.cb-info-box > .wp-block-column + .wp-block-column {
    border-left: 1px solid var(--accent-border);
  }
}

/* Mobile: columns stack — flip dividers to top borders */
@media (max-width: 768px) {
  .wp-block-columns.cb-info-box > .wp-block-column + .wp-block-column {
    border-top: 1px solid var(--accent-border);
    margin-top: 14px;
    padding-top: 18px;
  }
}

/* Icon: small image with a soft circular teal background */
.wp-block-columns.cb-info-box .wp-block-image {
  margin: 0;
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
}
.wp-block-columns.cb-info-box .wp-block-image img {
  width: 20px;
  height: 20px;
  padding: 9px;
  background: #c8ede4;
  border-radius: 50%;
  object-fit: contain;
  display: block;
  box-sizing: content-box;
}

/* Heading and paragraph stack in column 2 */
.wp-block-columns.cb-info-box h1,
.wp-block-columns.cb-info-box h2,
.wp-block-columns.cb-info-box h3,
.wp-block-columns.cb-info-box h4,
.wp-block-columns.cb-info-box h5,
.wp-block-columns.cb-info-box h6 {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-strong);
  line-height: 1.2;
}
.wp-block-columns.cb-info-box p {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}


/* ══════════════════════════════
   cb-info-card / cb-info-card-bg
   Apply to a Column block (.wp-block-column).
   Vertical card: icon → heading → description → link with arrow.
   - cb-info-card    : no background (transparent)
   - cb-info-card-bg : translucent card with bg, border, padding
   Markup:
     <div class="wp-block-column cb-info-card[-bg]">
       <figure class="wp-block-image"><img ...></figure>
       <h3>Title</h3>
       <p>Description</p>
       <p><a href="...">Open link</a></p>
     </div>
   ══════════════════════════════ */

.cb-info-card,
.cb-info-card-bg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* Background variant */
.cb-info-card-bg {
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.18s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
body.theme-dark .cb-info-card-bg {
  background: rgba(13,40,40,0.45);
}
.cb-info-card-bg:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.85);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}
body.theme-dark .cb-info-card-bg:hover {
  background: rgba(13,40,40,0.7);
}

/* Image (figure wrapper + img) — small icon at the top */
.cb-info-card .wp-block-image,
.cb-info-card-bg .wp-block-image {
  margin: 0;
}
.cb-info-card .wp-block-image img,
.cb-info-card-bg .wp-block-image img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

/* Headings — keep current global h3 sizing, just tighten margins */
.cb-info-card h1, .cb-info-card h2, .cb-info-card h3,
.cb-info-card h4, .cb-info-card h5, .cb-info-card h6,
.cb-info-card-bg h1, .cb-info-card-bg h2, .cb-info-card-bg h3,
.cb-info-card-bg h4, .cb-info-card-bg h5, .cb-info-card-bg h6 {
  margin: 4px 0 0;
}

/* Description paragraph */
.cb-info-card p,
.cb-info-card-bg p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* Link paragraph (the one with the <a>) — teal, arrow after */
.cb-info-card p > a:only-child,
.cb-info-card-bg p > a:only-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
  transition: gap 0.18s ease, color 0.2s ease;
}
.cb-info-card p > a:only-child::after,
.cb-info-card-bg p > a:only-child::after {
  content: '→';
  font-weight: 700;
  transition: transform 0.18s ease;
}
.cb-info-card p > a:only-child:hover,
.cb-info-card-bg p > a:only-child:hover {
  color: var(--accent-2);
  gap: 10px;
}


/* ══════════════════════════════
   cb-quick-button
   Apply to a single Button block (.wp-block-button.cb-quick-button).
   Smaller, lighter version of cb-big_button: no icon background, no arrow.
   Markup:
     <a class="wp-block-button__link">
       <img>
       <strong>Title</strong>
       <mark>Subtitle</mark>
     </a>
   The <mark> is optional (uses the same :has() trick as big_button).
   ══════════════════════════════ */

.wp-block-button.cb-quick-button {
  width: 100%;
}

.wp-block-button.cb-quick-button .wp-block-button__link {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.2s ease, border-color 0.2s ease;
}

body.theme-dark .wp-block-button.cb-quick-button .wp-block-button__link {
  background: rgba(13,40,40,0.45);
}

.wp-block-button.cb-quick-button .wp-block-button__link:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.85);
  border-color: var(--accent-border);
  color: var(--text);
}

body.theme-dark .wp-block-button.cb-quick-button .wp-block-button__link:hover {
  background: rgba(13,40,40,0.7);
}

/* Icon — no background, just the image */
.wp-block-button.cb-quick-button .wp-block-button__link img {
  width: 36px !important;
  height: 36px !important;
  flex-shrink: 0;
  object-fit: contain;
  grid-column: 1;
  grid-row: 1 / span 2;
}

/* Title */
.wp-block-button.cb-quick-button .wp-block-button__link strong {
  display: block;
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.2;
}

/* Subtitle */
.wp-block-button.cb-quick-button .wp-block-button__link mark {
  display: block;
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  margin-top: 2px;
}

/* If only <strong> is present (no subtitle), center it vertically */
.wp-block-button.cb-quick-button .wp-block-button__link:not(:has(mark)) strong {
  grid-row: 1 / span 2;
  align-self: center;
}


/* ══════════════════════════════
   cb-heading-center / cb-heading-left
   Apply to any heading block (h1–h6).
   Adds a horizontal line with a small diamond decoration.
   - cb-heading-center : decoration on BOTH sides
   - cb-heading-left   : heading stays left, decoration only on the RIGHT
   ══════════════════════════════ */

.cb-heading-center,
.cb-heading-left {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.cb-heading-center { justify-content: center; text-align: center; }
.cb-heading-left   { justify-content: flex-start; text-align: left; }

/* Decorative side: line with a diamond at the inner end (toward the text).
   The line is a centered horizontal background; the diamond is an SVG
   pinned to the inner edge via background-image. */
.cb-heading-center::before,
.cb-heading-center::after,
.cb-heading-left::after {
  content: '';
  flex: 1;
  height: 8px;
  min-width: 30px;
  background-repeat: no-repeat;
  background-color: transparent;
}

/* Diamond SVG — teal accent, ~8px */
.cb-heading-center::before {
  background-image:
    linear-gradient(var(--accent-border), var(--accent-border)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><rect x='1.5' y='1.5' width='5' height='5' transform='rotate(45 4 4)' fill='%2314b8a6'/></svg>");
  background-size: calc(100% - 14px) 1px, 8px 8px;
  background-position: left center, right center;
}

.cb-heading-center::after,
.cb-heading-left::after {
  background-image:
    linear-gradient(var(--accent-border), var(--accent-border)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><rect x='1.5' y='1.5' width='5' height='5' transform='rotate(45 4 4)' fill='%2314b8a6'/></svg>");
  background-size: calc(100% - 14px) 1px, 8px 8px;
  background-position: right center, left center;
}


/* ══════════════════════════════
   cb-big_button
   Apply to a Buttons block (.wp-block-buttons).
   Each child .wp-block-button becomes a big feature card.
   Markup expected per button:
     <a><img class="cb-big_button-icon" src="..."> <strong>Title</strong> Subtitle</a>
   The img/strong/text-node order is what produces the layout.
   ══════════════════════════════ */

/* Wrapper (.wp-block-buttons) — target via :has() since the cb-big_button
   class lives on the child .wp-block-button, not on the wrapper. */
.wp-block-buttons:has(> .wp-block-button.cb-big_button) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.wp-block-button.cb-big_button {
  width: 100% !important;
  flex-basis: 100% !important;
  max-width: 100% !important;
}

.cb-big_button .wp-block-button__link {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 16px;
  width: 100%;
  padding: 16px 56px 16px 16px; /* right pad reserved for arrow */
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cb-big_button .wp-block-button__link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
  color: var(--text);
}

/* Image is column 1 spanning both rows; strong/mark stack in column 2 */
.cb-big_button .wp-block-button__link img {
  grid-column: 1;
  grid-row: 1 / span 2;
}
.cb-big_button .wp-block-button__link strong { grid-column: 2; grid-row: 1; align-self: end; }
.cb-big_button .wp-block-button__link mark   { grid-column: 2; grid-row: 2; align-self: start; }

/* If only <strong> is present (no subtitle), center it vertically */
.cb-big_button .wp-block-button__link:not(:has(mark)) strong {
  grid-row: 1 / span 2;
  align-self: center;
}

/* ── Icon (the <img> inside the anchor) ── */
.cb-big_button .wp-block-button__link img {
  width: 45px !important;
  height: 45px !important;
  flex-shrink: 0;
  padding: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(13,148,136,0.25);
}

/* ── Title (use <strong> in the editor for the big line) ── */
.cb-big_button .wp-block-button__link strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-strong);
  line-height: 1.2;
  margin-bottom: 4px;
}

/* ── Subtitle (use <mark> in the editor for the small line below) ── */
.cb-big_button .wp-block-button__link mark {
  display: block;
  background: transparent !important;
  color: var(--text) !important;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

/* ── Arrow (pure CSS, right side) ── */
.cb-big_button .wp-block-button__link::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 50%;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  background-color: var(--accent-soft);
  border-radius: 50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d9488' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 6 15 12 9 18'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  transition: transform 0.18s ease, background-color 0.2s ease;
}
.cb-big_button .wp-block-button__link:hover::after {
  transform: translateX(3px);
  background-color: var(--accent-border);
}

/* ── Desktop: 3 across ── */
@media (min-width: 769px) {
  .cb-big_button.wp-block-buttons {
    flex-direction: row;
    gap: 18px;
  }
  .cb-big_button .wp-block-button {
    flex: 1;
  }
  .cb-big_button .wp-block-button__link {
    padding: 22px 64px 22px 22px;
    column-gap: 18px;
  }
  .cb-big_button .wp-block-button__link strong {
    font-size: 15px;
  }
  .cb-big_button .wp-block-button__link::after {
    right: 22px;
  }
}
