/*
Theme Name: HeartBeat Studio Modular v2
Theme URI: https://example.com/heartbeat-studio-theme
Author: ChatGPT
Author URI: https://openai.com
Description: A minimal, warm, and flexible WordPress theme adapted from a static HTML mockup. Colors are controlled via CSS variables and the WordPress Customizer.
Version: 1.0.6
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: heartbeat-studio
Tags: one-column, blog, custom-colors, custom-menu, custom-logo, editor-style
*/

:root {
  /* Defaults; these can be overridden via Customizer (see functions.php) */
  --ink:#14182e;
  --plum:#502189;
  --coral:#ff715b;
  --sand:#faf7f3;
  --cloud:#ffffff;
  --muted:#6b6f86;
  --radius:20px;
  --shadow: 0 10px 30px rgba(20,24,46,0.10);
  --shadow-sm: 0 6px 20px rgba(20,24,46,0.08);
  --max: 1120px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin:0;
  font: 16px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji;
  color: var(--ink);
  background: var(--sand);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container { max-width: var(--max); margin: 0 auto; padding: clamp(16px, 4vw, 32px); }
a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }
header.site { position:sticky; top:0; backdrop-filter:saturate(150%) blur(6px); background: color-mix(in srgb, var(--sand), white 35% / 80%); border-bottom: 1px solid rgba(20,24,46,0.06); z-index: 10; }
.brand { display:flex; align-items:center; gap:.6rem; font-weight:800; letter-spacing:.2px; }
.brand .logo {
  display:inline-block;
  width:48px;
  height:48px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* Note: Logo image controlled via WordPress Customizer > Site Identity > Logo */
}
nav a { margin-left: 14px; padding:.4rem .7rem; border-radius:999px; }
nav a:hover { background: rgba(80,33,137,0.06); text-decoration:none; }
.pill { display:inline-flex; align-items:center; gap:.5rem; padding:.8rem 1.1rem; border-radius:999px; font-weight:600; border:1px solid rgba(20,24,46,0.08); background:var(--cloud); box-shadow: var(--shadow-sm); }
.pill.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--plum), white 12%), var(--plum)); color:#fff; border-color: transparent; }
.pill.secondary { background: var(--cloud); }
.pill:active { transform: translateY(1px); }
.muted { color: var(--muted); }
.cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.card { padding: 20px; background: var(--cloud); border-radius: var(--radius); box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 1.1rem; }
footer.site { margin-top: 48px; border-top: 1px solid rgba(20,24,46,0.06); }
.cta-strip { border-radius: var(--radius); color:#fff; background: linear-gradient(140deg, var(--plum), color-mix(in srgb, var(--coral), var(--plum) 20%)); padding: clamp(20px, 4vw, 32px); box-shadow: var(--shadow); }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* Basic layout for blog & pages */
.page-header { padding: 24px 0 0; }
.archive-title, .page-title { font-size: clamp(28px, 4vw, 42px); line-height:1.1; margin: .2em 0 .5em; }
.post-list { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.post-card { background: var(--cloud); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.post-card h2 { margin: 0 0 .3em; font-size: 1.25rem; }
.post-card .meta { color: var(--muted); font-size: .9rem; }
.content-narrow { max-width: 820px; margin: 0 auto; }
.entry-content { background: var(--cloud); padding: clamp(16px, 3vw, 24px); border-radius: var(--radius); box-shadow: var(--shadow); }
blockquote { border-left: 4px solid var(--plum); padding-left: 12px; margin-left: 0; color: var(--muted); }
.wp-block-button__link, .button, .btn { composes: pill; } /* harmless if composes unsupported */

/* App card wrapper: controls the real width */
.app-card-wrap {
  width: min(60%, 640);   /* ← tweak this number to match screenshot #2 */
  margin: 0 auto;            /* center it */
}

/* Optional: make the inline grid stack on phones (override inline style) */
@media (max-width: 640px) {
  .app-card-wrap .card { grid-template-columns: 1fr !important; text-align: center; }
  .app-card-wrap [aria-hidden] { max-width: 140px; margin: 0 auto; }
}

/* ========================================
   BLOCK PATTERN STYLES
   Add these to your style.css file
   ======================================== */

/* Shadow utility class */
.has-shadow {
  box-shadow: var(--shadow, 0 10px 30px rgba(20,24,46,0.10));
}

/* Base background adjustments for cards */
.has-base-background-color {
  background-color: var(--cloud, #ffffff);
}

/* Button styles for block editor */
.wp-block-button__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid rgba(20,24,46,0.08);
  background: var(--cloud, #ffffff);
  box-shadow: var(--shadow-sm, 0 6px 20px rgba(20,24,46,0.08));
  transition: all 0.2s ease;
  text-decoration: none;
}

.wp-block-button.is-style-fill .wp-block-button__link {
  background: linear-gradient(180deg, color-mix(in srgb, var(--plum, #502189), white 12%), var(--plum, #502189));
  color: #fff;
  border-color: transparent;
}

.wp-block-button.is-style-outline .wp-block-button__link {
  background: var(--cloud, #ffffff);
  color: var(--plum, #502189);
  border: 2px solid var(--plum, #502189);
}

.wp-block-button__link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(20,24,46,0.12);
}

.wp-block-button__link:active {
  transform: translateY(1px);
}

/* Group styles */
.wp-block-group {
  margin-block-start: 0;
  margin-block-end: 0;
}

/* Image styles */
.wp-block-image img {
  height: auto;
  max-width: 100%;
}

/* Column responsiveness */
@media (max-width: 781px) {
  .wp-block-columns:not(.is-not-stacked-on-mobile) {
    flex-direction: column;
  }
  
  .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
    flex-basis: 100% !important;
  }
  
  .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column[style*="order: 2"] {
    order: 0 !important;
  }
}

/* Quote styles */
.wp-block-quote.is-style-plain {
  border: none;
  padding: 0;
}

.wp-block-quote {
  margin: 0;
}

/* List styles in colored contexts */
.has-text-color ul,
.has-text-color ol {
  color: inherit;
}

/* Muted text color helper */
.has-muted-color {
  color: var(--muted, #6b6f86);
}

/* Responsive typography */
@media (max-width: 600px) {
  h1, .wp-block-heading h1 {
    font-size: clamp(28px, 8vw, 42px) !important;
  }
  
  h2, .wp-block-heading h2 {
    font-size: clamp(24px, 6vw, 32px) !important;
  }
}

/* Gradient background utilities */
.has-plum-coral-gradient-background {
  background: linear-gradient(140deg, var(--plum, #502189), var(--coral, #ff715b));
}

/* Ensure full-width sections work properly */
.wp-block-group.alignfull {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
  max-width: 100vw;
}

/* Container for constrained content */
.wp-block-group.alignwide {
  max-width: var(--max, 1120px);
  margin-left: auto;
  margin-right: auto;
}

/* Fix for button groups */
.wp-block-buttons {
  gap: 10px;
}

.wp-block-buttons .wp-block-button {
  margin: 0;
}

/* Flex layout improvements */
.wp-block-group.is-layout-flex {
  gap: var(--wp--style--block-gap, 1.5rem);
}

/* Image aspect ratio support */
.wp-block-image img[style*="aspect-ratio"] {
  object-fit: cover;
}

/* List spacing in groups */
.wp-block-group ul,
.wp-block-group ol {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.wp-block-group li {
  margin-bottom: 0.3em;
}

/* Testimonial specific styles */
.wp-block-quote.is-style-plain cite {
  font-style: normal;
  font-weight: 600;
}

/* Card hover effects (optional) */
.has-shadow:hover {
  box-shadow: 0 12px 35px rgba(20,24,46,0.15);
  transition: box-shadow 0.3s ease;
}

/* Ensure proper text color inheritance */
.has-text-color {
  color: inherit;
}

.has-text-color a {
  color: inherit;
}

/* Fix for nested groups */
.wp-block-group .wp-block-group {
  margin: 0;
}

/* Spacing utilities for block patterns */
.wp-block-group[style*="padding"] {
  box-sizing: border-box;
}

/* Responsive image + text layouts */
@media (max-width: 781px) {
  .wp-block-columns .wp-block-column[style*="flex-basis:40%"],
  .wp-block-columns .wp-block-column[style*="flex-basis:60%"] {
    flex-basis: 100% !important;
  }
  
  .wp-block-image {
    margin-bottom: 1.5rem;
  }
}

/* App showcase specific styling */
.wp-block-group.is-layout-flex .wp-block-image {
  flex-shrink: 0;
}

/* Better button alignment in flex containers */
.wp-block-buttons.is-layout-flex {
  flex-wrap: wrap;
}

/* CTA gradient text color override */
.has-background[style*="gradient"] {
  color: #ffffff;
}

.has-background[style*="gradient"] .wp-block-heading {
  color: #ffffff;
}

.has-background[style*="gradient"] p {
  color: #ffffff;
}

/* Editor-specific styles (will only show in editor) */
.editor-styles-wrapper .has-shadow {
  box-shadow: var(--shadow, 0 10px 30px rgba(20,24,46,0.10));
}

.editor-styles-wrapper .wp-block-button__link {
  cursor: pointer;
}

/* Accessibility improvements */
.wp-block-button__link:focus,
.wp-block-button__link:focus-visible {
  outline: 2px solid var(--plum, #502189);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .wp-block-buttons {
    display: none;
  }

  .has-shadow {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Modal Overlay Styles */
.hb-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 32px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.hb-modal-overlay[style*="display: flex"] {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: all !important;
}

.hb-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 24, 46, 0.6);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

.hb-modal-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  background: var(--cloud);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(20, 24, 46, 0.3);
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

.hb-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: var(--cloud);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  color: var(--ink);
}

.hb-modal-close:hover {
  background: var(--sand);
  transform: scale(1.05);
}

.hb-modal-close:active {
  transform: scale(0.95);
}

.hb-modal-content {
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(24px, 5vw, 48px);
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}

.hb-modal-content::-webkit-scrollbar {
  width: 8px;
}

.hb-modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.hb-modal-content::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 4px;
}

.hb-modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--ink);
}

/* Modal animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Prevent body scroll when modal is open */
body.hb-modal-open {
  overflow: hidden;
}

/* Responsive modal styles */
@media (max-width: 768px) {
  .hb-modal-container {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .hb-modal-content {
    padding: clamp(20px, 4vw, 32px);
  }

  .hb-modal-close {
    width: 40px;
    height: 40px;
  }
}

/* Responsive layout fixes for front page */
@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr !important;
  }

  .app-showcase-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
    gap: 24px !important;
  }

  .app-showcase-grid > div[aria-hidden] {
    margin: 0 auto;
    max-width: 160px;
  }

  .app-showcase-grid > div:not([aria-hidden]) {
    text-align: center;
  }

  .app-showcase-grid ul {
    text-align: left;
    display: inline-block;
    margin: 0 auto;
  }

  .app-showcase-grid h2 {
    font-size: clamp(1.3rem, 5vw, 1.75rem);
  }

  .app-showcase-grid .pill {
    justify-content: center;
  }

  .app-card-wrap .card[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    text-align: center;
  }
}