/*
Theme Name: Blockhead
Theme URI:  https://strongclose.ai/blockhead
Author:     Kyle Alm
Author URI: https://strongclose.ai
Description: A minimal block theme foundation with 31 pre-designed patterns. Designed for AI-assisted development and child theme extension. Custom blocks available via companion Blockhead Blocks plugin.
Version:    1.2.0
Requires at least: 6.3
Tested up to: 6.4
Requires PHP: 7.4
License:    GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: blockhead
Tags: full-site-editing, block-patterns, block-styles, accessibility-ready, one-column, wide-blocks, custom-colors, custom-menu, editor-style, threaded-comments, translation-ready

Blockhead WordPress Theme, (C) 2024-2026 Kyle Alm
Blockhead is distributed under the terms of the GNU GPL.
*/

/* === Base Resets === */
body {
  margin: 0;
}

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

/* === ACF Fields Display Styles === */
/* These styles integrate with WordPress content styling to blend seamlessly */
/* ACF fields are appended to post-content block, making them direct children of .is-layout-constrained */
/* WordPress automatically applies constrained layout via: */
/* .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) */
/* Our ACF fields match this selector pattern, so they inherit the layout automatically */

/* Main ACF Fields Container - minimal spacing only */
/* Constrained width and centering come from WordPress core layout system */
.blockhead-acf-fields {
  margin-top: var(--wp--preset--spacing--60, 2rem);
  padding-top: var(--wp--preset--spacing--60, 2rem);
}

/* ACF Section Title - inherits h2 styling from WordPress */
.blockhead-acf-title {
  margin-bottom: var(--wp--preset--spacing--50, 1.5rem);
}

/* Field Group Container - inherits content flow */
.blockhead-field-group {
  margin-bottom: var(--wp--preset--spacing--60, 2rem);
}

/* Field Group Title - inherits h3 styling from WordPress */
.blockhead-field-group-title {
  margin-bottom: var(--wp--preset--spacing--40, 1rem);
}

/* Location Rules Display - subtle metadata, smaller text */
.blockhead-location-rules {
  margin-bottom: var(--wp--preset--spacing--40, 1rem);
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  opacity: 0.7;
}

/* Fields Grid Container - simple list-like layout */
.blockhead-fields {
  display: grid;
  gap: var(--wp--preset--spacing--40, 1rem);
  margin-bottom: var(--wp--preset--spacing--40, 1rem);
}

/* Individual Field Container - no visual separation, just spacing */
.blockhead-field {
  margin-bottom: var(--wp--preset--spacing--40, 1rem);
}

/* Field Header */
.blockhead-field-header {
  margin-bottom: var(--wp--preset--spacing--30, 0.5rem);
}

/* Field Label - inherits strong/bold styling from WordPress */
.blockhead-field-label {
  font-weight: 600;
}

/* Field Name (slug) - subtle metadata, smaller and lighter */
.blockhead-field-name {
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  opacity: 0.7;
  font-weight: normal;
}

/* Field Type Badge - very subtle, minimal visual weight */
.blockhead-field-type {
  font-size: var(--wp--preset--font-size--small, 0.75rem);
  padding: var(--wp--preset--spacing--20, 0.25rem) var(--wp--preset--spacing--30, 0.5rem);
  background: transparent;
  color: currentColor;
  border: 1px solid currentColor;
  border-radius: 3px;
  margin-left: var(--wp--preset--spacing--30, 0.5rem);
  opacity: 0.4;
  display: inline-block;
  font-weight: normal;
}

/* Field Value Container - inherits all content styling from WordPress */
.blockhead-field-value {
  margin-top: var(--wp--preset--spacing--30, 0.5rem);
}

/* Field Value Empty State */
.blockhead-field-value em {
  opacity: 0.6;
  font-style: italic;
}

/* === Formatted Field Value Styles === */

/* Code/Pre formatting for complex values */
.blockhead-field-value pre {
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Image formatting */
.blockhead-field-value img,
.blockhead-field img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Gallery grid */
.blockhead-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--wp--preset--spacing--40, 1rem);
}

.blockhead-gallery img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Repeater/Flexible Content rows - minimal styling, subtle left border */
.blockhead-repeater-row {
  margin-bottom: var(--wp--preset--spacing--40, 1rem);
  padding-left: var(--wp--preset--spacing--40, 1rem);
  border-left: 2px solid currentColor;
  opacity: 0.2;
}

.blockhead-repeater-row strong {
  display: block;
  margin-bottom: var(--wp--preset--spacing--30, 0.5rem);
}

.blockhead-repeater-grid {
  display: grid;
  gap: var(--wp--preset--spacing--40, 1rem);
}

/* Google Map container */
.blockhead-google-map {
  padding: var(--wp--preset--spacing--30, 0.5rem) 0;
}

.blockhead-google-map > div {
  margin-bottom: var(--wp--preset--spacing--30, 0.5rem);
}

.blockhead-google-map > div:last-child {
  margin-bottom: 0;
}

.blockhead-google-map .blockhead-map-coords {
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  color: var(--wp--preset--color--text-light, #666);
}

.blockhead-google-map a {
  color: var(--wp--preset--color--primary, #1976d2);
  text-decoration: underline;
}

/* Icon picker display */
.blockhead-icon-picker .dashicons {
  font-size: var(--wp--preset--font-size--xx-large, 2rem);
}

/* Select/Checkbox/Radio lists */
.blockhead-field-value ul {
  margin: 0;
  padding-left: var(--wp--preset--spacing--50, 1.5rem);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .blockhead-fields {
    grid-template-columns: 1fr;
  }

  .blockhead-gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* === Accessibility Styles === */

/**
 * Screen Reader Text
 *
 * Hide content visually while keeping it accessible to screen readers.
 * Used for skip links, additional context, and hidden labels.
 */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

/**
 * Skip Link Focus State
 *
 * Make skip link visible when focused (keyboard navigation).
 */
.screen-reader-text:focus,
.skip-link:focus {
  background-color: #f1f1f1;
  border-radius: 3px;
  box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
  clip: auto !important;
  clip-path: none;
  color: #21759b;
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
}

/* === Print Styles === */
@media print {
  /* Hide non-essential elements */
  .skip-link,
  .screen-reader-text,
  nav,
  .wp-block-navigation,
  .wp-block-search,
  .wp-block-blockhead-slider .slider-arrow,
  .wp-block-blockhead-slider .slider-dots,
  .wp-block-blockhead-testimonial-slider .testimonial-arrow,
  .wp-block-blockhead-testimonial-slider .testimonial-dots,
  .wp-block-blockhead-accordion button[aria-expanded],
  .wp-block-blockhead-tabs [role="tablist"],
  .wp-block-blockhead-info-box .alert-close,
  .wp-block-blockhead-cta-lead-magnet form,
  video,
  audio,
  iframe,
  .wp-block-embed,
  .wp-block-blockhead-google-map {
    display: none !important;
  }

  /* Reset backgrounds and use black text */
  body,
  .wp-site-blocks,
  .entry-content,
  article {
    background: #fff !important;
    color: #000 !important;
  }

  /* Ensure content uses full width */
  .wp-site-blocks,
  .entry-content,
  main {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Show all accordion content */
  .wp-block-blockhead-accordion .accordion-content {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Show all tab panels */
  .wp-block-blockhead-tabs [role="tabpanel"] {
    display: block !important;
  }

  /* Show all slider/carousel items */
  .wp-block-blockhead-slider .slider-track,
  .wp-block-blockhead-testimonial-slider .testimonial-track {
    display: block !important;
    transform: none !important;
  }

  .wp-block-blockhead-slider .slider-item,
  .wp-block-blockhead-testimonial-slider .testimonial-item {
    display: block !important;
    position: static !important;
    opacity: 1 !important;
    page-break-inside: avoid;
    margin-bottom: 1rem;
  }

  /* Show URLs after links */
  a[href^="http"]:after,
  a[href^="https"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    font-weight: normal;
    word-break: break-all;
  }

  /* Don't show URLs for internal anchors or buttons */
  a[href^="#"]:after,
  .wp-block-button a:after,
  .wp-block-blockhead-advanced-button a:after {
    content: none;
  }

  /* Ensure images print properly */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Avoid page breaks in critical elements */
  h1, h2, h3, h4, h5, h6,
  blockquote,
  pre,
  .wp-block-blockhead-icon-box,
  .wp-block-blockhead-pricing-card,
  .wp-block-blockhead-team-member,
  .wp-block-blockhead-info-box {
    page-break-inside: avoid;
  }

  /* Keep headings with following content */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  /* Remove decorative shadows and effects */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Info box - show content without interactive elements */
  .wp-block-blockhead-info-box {
    border: 1px solid #000 !important;
    background: #fff !important;
  }

  /* Ensure sufficient contrast for all text */
  .wp-block-blockhead-info-box,
  .wp-block-blockhead-info-box * {
    color: #000 !important;
  }
}