/**
 * Build Break Automate - Custom Styles
 *
 * Supplements theme.json with styles that can't be expressed in JSON.
 * Kept minimal - most styling is handled by the block editor + theme.json.
 */

/* ========================================================================
   Base & Reset
   ======================================================================== */

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

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Tighten up default WordPress block spacing */
.entry-content > * + * {
	margin-top: 1.5em;
}

/* ========================================================================
   Navigation
   ======================================================================== */

/* Compact nav - no wasted vertical space */
.wp-block-navigation .wp-block-navigation-item a {
	padding: 0.5rem 0;
	transition: color 0.15s ease;
}

.wp-block-navigation .wp-block-navigation-item a:hover {
	color: var(--wp--preset--color--accent);
}

/* CTA button in nav */
.wp-block-navigation-item--cta a {
	padding: 0.5rem 1.25rem !important;
	border-radius: 6px;
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--primary) !important;
	transition: background-color 0.15s ease, transform 0.1s ease;
}

/* Site logo (patterns/site-logo.php): light artwork by default, dark artwork in dark mode
   or inside a .brk-logo--on-dark wrapper (footer). */
.brk-logo {
	display: inline-block;
	line-height: 0;
}

.brk-logo img {
	height: 44px;
	width: auto;
}

.brk-logo__dark,
[data-theme="dark"] .brk-logo__light,
.brk-logo--on-dark .brk-logo__light {
	display: none;
}

[data-theme="dark"] .brk-logo__dark,
.brk-logo--on-dark .brk-logo__dark {
	display: inline;
}

.brk-logo--on-dark .brk-logo img {
	height: 40px;
}

.wp-block-navigation-item--cta a:hover {
	background-color: var(--wp--preset--color--accent-hover) !important;
	color: var(--wp--preset--color--primary) !important;
	transform: translateY(-1px);
}

/* ========================================================================
   Service Cards
   ======================================================================== */

.brk-service-card {
	transition: box-shadow 0.2s ease, transform 0.2s ease;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.brk-service-card:hover {
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

/* Every service card is the same size: both rows of the grid share one CSS grid,
   so all rows take the tallest card's height, and Learn more sits on the bottom edge. */
.brk-services-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-auto-rows: 1fr;
	gap: var(--wp--preset--spacing--40);
}

.brk-services-grid > .wp-block-columns {
	display: contents;
}

.brk-services-grid .wp-block-column {
	display: flex;
}

.brk-services-grid .brk-service-card {
	display: flex;
	flex: 1;
	flex-direction: column;
}

.brk-services-grid .brk-service-card > :last-child {
	margin-top: auto;
	padding-top: var(--wp--style--block-gap, 1.5rem);
}

@media (max-width: 781px) {
	.brk-services-grid {
		grid-template-columns: minmax(0, 1fr);
		grid-auto-rows: auto;
	}
}

/* A card's example is evidence, quieter than the description above it. */
.brk-service-example strong {
	font-weight: 600;
}

.brk-service-card .brk-service-example a {
	color: inherit;
	text-decoration: none;
}

.brk-service-card .brk-service-example a:hover,
.brk-service-card .brk-service-example a:focus-visible {
	color: var(--wp--preset--color--secondary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Typical problems: info button in the card's top right, tooltip on hover or focus */
.brk-service-card {
	position: relative;
}

.brk-service-card:hover,
.brk-service-card:focus-within {
	z-index: 2;
}

.brk-service-card > .brk-problems + * {
	margin-top: 0;
	padding-right: 1.75rem;
}

.brk-problems {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	margin: 0;
}

.brk-problems__toggle {
	display: flex;
	padding: 0.25rem;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--wp--preset--color--text-light);
	cursor: help;
}

.brk-problems__toggle:hover,
.brk-problems__toggle:focus-visible {
	color: var(--wp--preset--color--secondary);
}

.brk-problems__toggle:focus-visible {
	outline: 2px solid var(--wp--preset--color--secondary);
	outline-offset: 1px;
}

.brk-problems__tip {
	position: absolute;
	top: calc(100% + 0.375rem);
	right: 0;
	width: min(18rem, 80vw);
	padding: 0.75rem 0.875rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 6px;
	background: var(--wp--preset--color--white);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
	color: var(--wp--preset--color--text-primary);
	font-size: 0.875rem;
	line-height: 1.5;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}

.brk-problems__tip strong {
	display: block;
	margin-bottom: 0.25rem;
}

.brk-problems:hover .brk-problems__tip,
.brk-problems:focus-within .brk-problems__tip {
	visibility: visible;
	opacity: 1;
}

/* ========================================================================
   Post Cards
   ======================================================================== */

.brk-post-card {
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.brk-post-card:hover {
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

/* ========================================================================
   Buttons
   ======================================================================== */

.wp-block-button__link {
	transition: background-color 0.15s ease, transform 0.1s ease;
}

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

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background-color: rgba(255, 255, 255, 0.1) !important;
}

/* ========================================================================
   Code Blocks (Prism.js integration)
   ======================================================================== */

/* Ensure code blocks don't overflow on mobile */
.wp-block-code pre,
.wp-block-preformatted pre {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	tab-size: 4;
}

.wp-block-code code,
.wp-block-preformatted code {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.875rem;
	line-height: 1.6;
}

/* Scrollbar styling for code blocks */
.wp-block-code pre::-webkit-scrollbar,
.wp-block-preformatted pre::-webkit-scrollbar {
	height: 6px;
}

.wp-block-code pre::-webkit-scrollbar-track,
.wp-block-preformatted pre::-webkit-scrollbar-track {
	background: rgba(255, 255, 255, 0.05);
	border-radius: 3px;
}

.wp-block-code pre::-webkit-scrollbar-thumb,
.wp-block-preformatted pre::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.15);
	border-radius: 3px;
}

/* ========================================================================
   Footer
   ======================================================================== */

footer a {
	color: var(--wp--preset--color--text-light) !important;
	text-decoration: none;
	transition: color 0.15s ease;
}

footer a:hover {
	color: var(--wp--preset--color--accent) !important;
}

/* No-bullets list style */
.is-style-no-bullets {
	list-style: none;
	padding-left: 0 !important;
}

/* ========================================================================
   Email Subscribe Form (inline, replaces WP Subscribe widget)
   ======================================================================== */

.brk-subscribe-form {
	display: flex;
	gap: 0.5rem;
	max-width: 480px;
}

.brk-subscribe-form input[type="email"] {
	flex: 1;
	padding: 0.75rem 1rem;
	border: 2px solid var(--wp--preset--color--border);
	border-radius: 6px;
	font-size: 0.9375rem;
	font-family: var(--wp--preset--font-family--body);
	transition: border-color 0.15s ease;
}

.brk-subscribe-form input[type="email"]:focus {
	outline: none;
	border-color: var(--wp--preset--color--accent);
}

.brk-subscribe-form button {
	padding: 0.75rem 1.5rem;
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--primary);
	border: none;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.9375rem;
	cursor: pointer;
	transition: background-color 0.15s ease;
	white-space: nowrap;
}

.brk-subscribe-form button:hover {
	background: var(--wp--preset--color--accent-hover);
}

/* ========================================================================
   Responsive Adjustments
   ======================================================================== */

@media (max-width: 781px) {
	/* Stack service cards on tablet */
	.wp-block-columns {
		gap: 1rem !important;
	}

	/* Reduce hero padding on mobile */
	.alignfull[class*="hero-gradient"] {
		padding-top: 3rem !important;
		padding-bottom: 3rem !important;
	}

	/* Stack subscribe form */
	.brk-subscribe-form {
		flex-direction: column;
	}

	.brk-subscribe-form button {
		width: 100%;
	}
}

/* ---------------------------------------------------------------------------
   Booking embed (Contact page)

   A plain Calendly iframe, so nothing inside it reports a height back to us the
   way widget.js would. The height is fixed per breakpoint instead. Calendly's
   inline view needs 320px of width before it will lay out.
   --------------------------------------------------------------------------- */

.brk-booking {
	border-radius: 8px;
	overflow: hidden;
}

/*
 * Height is fixed because nothing reports the content size back across the
 * frame boundary, so it is set here and tuned by eye against the rendered embed.
 *
 * With hide_event_type_details the header block is gone and the idle view came to
 * about 600px at 458px wide, measured on 2026-09-29. Overshoot is visible: the
 * card no longer fills the frame, and Calendly's own page body behind it stays
 * white whatever background_color says, so 620px showed a white strip along the
 * bottom in dark mode. Undershoot gives Calendly an internal scrollbar instead.
 *
 * Both failure modes are cosmetic and this is tuned to one month layout at one
 * width. Picking a day grows the content past this height and the frame scrolls
 * internally, which is the accepted cost of not loading Calendly's widget.js.
 */
.brk-booking__frame {
	display: block;
	width: 100%;
	min-width: 320px;
	height: 600px;
	border: 0;
}

@media (max-width: 781px) {
	.brk-booking__frame {
		height: 680px;
	}
}

.brk-booking__fallback {
	margin: 1rem 0 0;
}

/* Shown only when no event is configured, so the page never renders a dead frame. */
.brk-booking--unset {
	background: var(--wp--preset--color--surface-alt);
	border: 2px dashed var(--wp--preset--color--border);
	padding: 3rem 2rem;
	text-align: center;
	color: var(--wp--preset--color--text-secondary);
}

.brk-booking__title {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 0.5rem;
}

.brk-booking__note {
	font-size: 0.875rem;
	margin: 0;
}

/* A page whose sections all come from its template (Home, Contact) renders an
   empty content block. Hidden, so it adds no gap between template sections. */
.wp-block-post-content:empty {
	display: none;
}

/* Template sections follow the page content as a sibling, where the layout gap
   is smaller than the 1.5em between blocks inside the content. Matched here so
   moving shared sections into the templates left the spacing unchanged. */
main > * + .brk-template-sections {
	margin-top: 1.5em;
}
