/*
Theme Name: Deerbridge
Theme URI: https://deerbridgepsych.com
Author: Metzae Media
Author URI: https://metzae.media
Description: Custom theme for Deerbridge Psychiatry. Streamlined, modern, mobile-first. Block-editor first.
Version: 1.0.11
Tested up to: 7.0
Requires PHP: 8.0
Requires at least: 6.5
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: deerbridge
Tags: blog, custom-colors, custom-logo, custom-menu, editor-style, featured-images, footer-widgets, full-width-template, threaded-comments, translation-ready, wide-blocks
*/

/* ---------- design tokens ---------- */
:root {
	--db-color-bg: #fafaf7;
	--db-color-surface: #ffffff;
	--db-color-text: #1c1f17;
	--db-color-muted: #5b6155;
	--db-color-border: #e3e1d8;
	--db-color-primary: #608314;
	--db-color-primary-ink: #ffffff;
	--db-color-primary-soft: #ecf2da;
	--db-color-accent: #aeff54;

	--db-font-display: "Roboto Slab", Georgia, "Times New Roman", serif;
	--db-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
	--db-font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

	--db-step--1: clamp(0.875rem, 0.83rem + 0.22vw, 1rem);
	--db-step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
	--db-step-1: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
	--db-step-2: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
	--db-step-3: clamp(1.625rem, 1.4rem + 1.1vw, 2.25rem);
	--db-step-4: clamp(2rem, 1.6rem + 1.8vw, 3rem);
	--db-step-5: clamp(2.5rem, 2rem + 2.5vw, 4rem);

	--db-content-width: 720px;
	--db-wide-width: 1080px;
	--db-page-pad: clamp(1rem, 4vw, 1.5rem);

	--db-radius: 6px;
	--db-radius-lg: 12px;
	--db-shadow-sm: 0 1px 2px rgba(28, 31, 23, 0.06);
	--db-shadow-md: 0 4px 16px -4px rgba(28, 31, 23, 0.12);

	--db-bg-image: url("/wp-content/uploads/2025/06/ChatGPT-Image-Jun-16-2025-10_43_39-PM.png");
	--db-bg-overlay: rgba(20, 25, 18, 0.30);
	--db-color-text-on-bg: #ffffff;
	--db-color-text-on-bg-muted: rgba(255, 255, 255, 0.85);
	--db-text-shadow-on-bg: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
	margin: 0;
	font-family: var(--db-font-body);
	font-size: var(--db-step-0);
	line-height: 1.65;
	color: var(--db-color-text-on-bg);
	text-shadow: var(--db-text-shadow-on-bg);
	background-color: #1c1f17;
	background-image: linear-gradient(var(--db-bg-overlay), var(--db-bg-overlay)), var(--db-bg-image);
	background-repeat: no-repeat;
	background-position: center top;
	background-size: cover;
	background-attachment: fixed;
	-webkit-font-smoothing: antialiased;
}

/* iOS Safari ignores background-attachment: fixed on body — fall back to a fixed pseudo-element layer. */
@supports (-webkit-touch-callout: none) {
	body { background-attachment: scroll; }
	body::before {
		content: "";
		position: fixed; inset: 0;
		background-image: linear-gradient(var(--db-bg-overlay), var(--db-bg-overlay)), var(--db-bg-image);
		background-repeat: no-repeat;
		background-position: center top;
		background-size: cover;
		z-index: -1;
	}
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover, a:focus-visible { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--db-color-primary); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--db-font-display);
	line-height: 1.2;
	margin: 0 0 0.5em;
	letter-spacing: -0.01em;
	color: var(--db-color-text-on-bg);
}
a { color: var(--db-color-accent); }
a:hover, a:focus-visible { color: #ffffff; }

/* content inside primary-soft surfaces stays dark (no overlay context there) */
.has-primary-soft-background-color,
.has-primary-soft-background-color * {
	color: var(--db-color-text);
	text-shadow: none;
}
.has-primary-soft-background-color a { color: var(--db-color-primary); }
.has-primary-soft-background-color a:hover { color: var(--db-color-text); }
h1 { font-size: var(--db-step-5); }
h2 { font-size: var(--db-step-4); }
h3 { font-size: var(--db-step-3); }
h4 { font-size: var(--db-step-2); }
h5 { font-size: var(--db-step-1); }
h6 { font-size: var(--db-step-0); text-transform: uppercase; letter-spacing: 0.08em; }
p { margin: 0 0 1em; }
small { font-size: var(--db-step--1); color: var(--db-color-muted); }

/* ---------- layout ---------- */
.skip-link {
	position: absolute; top: -100px; left: 8px;
	padding: 8px 12px; background: var(--db-color-text); color: var(--db-color-bg);
	z-index: 100; border-radius: var(--db-radius);
}
.skip-link:focus { top: 8px; }

.db-container {
	width: 100%;
	max-width: var(--db-wide-width);
	margin-inline: auto;
	padding-inline: var(--db-page-pad);
}
.db-prose {
	max-width: var(--db-content-width);
	margin-inline: auto;
}

/* ---------- header ---------- */
.site-header {
	background: var(--db-color-surface);
	border-bottom: 1px solid var(--db-color-border);
	position: sticky; top: 0; z-index: 50;
	color: var(--db-color-text);
	text-shadow: none;
}
.site-header a { color: var(--db-color-text); }
.site-header .header-cta,
.site-header .header-cta:hover,
.site-header .header-cta:focus-visible { color: #ffffff; text-shadow: none; }
.site-title { color: var(--db-color-text); text-shadow: none; }
.site-title--sub { color: var(--db-color-muted); }
.site-header__inner {
	display: flex; align-items: center; gap: 1rem;
	min-height: 64px;
	padding-block: 12px;
}
.site-branding { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.site-branding a { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; color: inherit; }
.site-branding img,
.site-branding .custom-logo,
.site-branding .custom-logo-link,
.site-branding .custom-logo-link img {
	height: 36px;
	width: auto;
	max-width: none;
}
.site-title {
	font-family: var(--db-font-display);
	font-size: var(--db-step-1);
	font-weight: 600;
	margin: 0;
	letter-spacing: -0.01em;
}
.site-title--sub { color: var(--db-color-muted); font-weight: 400; font-size: var(--db-step--1); display: block; }

.main-navigation { margin-left: auto; }
.main-navigation ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.main-navigation a {
	display: inline-block; padding: 8px 12px;
	border-radius: var(--db-radius);
	color: var(--db-color-text); text-decoration: none;
	font-weight: 500;
}
.main-navigation a:hover, .main-navigation .current-menu-item a, .main-navigation .current_page_item a {
	background: var(--db-color-primary-soft); color: var(--db-color-primary);
}

.header-cta {
	display: inline-flex; align-items: center; gap: 0.4rem;
	background: var(--db-color-primary); color: var(--db-color-primary-ink);
	padding: 8px 14px; border-radius: var(--db-radius);
	font-weight: 600; text-decoration: none;
	font-size: var(--db-step--1);
	white-space: nowrap;
	flex-shrink: 0;
	margin-left: auto;
}
.header-cta:hover { background: var(--db-color-text); color: var(--db-color-bg); }

/* mobile menu toggle */
.nav-toggle {
	display: none;
	background: transparent; border: 1px solid var(--db-color-border);
	padding: 8px 12px; border-radius: var(--db-radius);
	font: inherit; cursor: pointer;
	margin-left: auto;
}

@media (max-width: 720px) {
	.nav-toggle { display: inline-block; }
	.main-navigation { display: none; order: 3; width: 100%; margin: 0; }
	.main-navigation.is-open { display: block; }
	.main-navigation ul { flex-direction: column; gap: 0; padding-block: 8px; }
	.main-navigation a { display: block; padding: 12px; border-radius: 0; }
	.header-cta { font-size: var(--db-step--1); padding: 6px 10px; }
}

/* ---------- main / content ---------- */
.site-main { padding-block: clamp(24px, 4vw, 40px); }
.entry-header { margin-bottom: clamp(16px, 3vw, 28px); }
.entry-title { margin: 0 0 0.25em; }
.entry-meta { color: var(--db-color-muted); font-size: var(--db-step--1); }
.entry-content > * + * { margin-top: clamp(12px, 2vw, 20px); }
.entry-content ul, .entry-content ol { padding-left: 1.25em; }
.entry-content li + li { margin-top: 6px; }
.entry-content blockquote {
	margin: 1.5em 0; padding: 0.75em 1.25em;
	border-left: 3px solid var(--db-color-primary);
	background: var(--db-color-primary-soft);
	border-radius: var(--db-radius);
	font-style: italic;
}
.entry-content hr {
	border: none; height: 1px; background: var(--db-color-border);
	margin-block: clamp(24px, 4vw, 40px);
}

/* ---------- buttons (core button block + .wp-element-button) ---------- */
.wp-block-button__link, .wp-element-button {
	display: inline-block;
	background: var(--db-color-primary); color: var(--db-color-primary-ink);
	padding: 12px 22px;
	border-radius: var(--db-radius);
	font-weight: 600;
	text-decoration: none;
	border: none;
	cursor: pointer;
	transition: background 0.15s ease;
}
.wp-block-button__link:hover, .wp-element-button:hover { background: var(--db-color-text); }
.is-style-outline .wp-block-button__link {
	background: transparent; color: var(--db-color-primary);
	box-shadow: inset 0 0 0 2px var(--db-color-primary);
}
.is-style-outline .wp-block-button__link:hover { background: var(--db-color-primary); color: var(--db-color-primary-ink); }

/* ---------- common block tweaks ---------- */
.wp-block-cover { border-radius: var(--db-radius-lg); }
.wp-block-image img { border-radius: var(--db-radius); }
.wp-block-group.is-style-card {
	background: var(--db-color-surface);
	border: 1px solid var(--db-color-border);
	border-radius: var(--db-radius-lg);
	padding: clamp(20px, 3vw, 32px);
	box-shadow: var(--db-shadow-sm);
}
.wp-block-separator { border: none; height: 1px; background: var(--db-color-border); margin-block: 24px; }

/* partner badges on home — uniform square images, all brand-colored from source */
.db-partners {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: clamp(16px, 3vw, 28px);
	padding-block: clamp(20px, 4vw, 32px);
}
.db-partner-image {
	display: block;
	width: clamp(96px, 13vw, 128px);
	height: clamp(96px, 13vw, 128px);
	border-radius: var(--db-radius-lg);
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.db-partner-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.db-partner-image:hover,
.db-partner-image:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

/* media-text hero: keep the image from getting cropped weird & give it a soft frame */
.wp-block-media-text .wp-block-media-text__media img {
	border-radius: var(--db-radius-lg);
	box-shadow: var(--db-shadow-md);
}

/* Right-floated hero portrait, text wraps around it. Stacks on mobile. */
.db-hero-portrait.alignright {
	margin: 4px 0 16px 24px;
	max-width: 40%;
}
.db-hero-portrait img {
	width: 100% !important;
	height: auto;
	border-radius: var(--db-radius-lg);
	box-shadow: var(--db-shadow-md);
}
@media (max-width: 540px) {
	.db-hero-portrait.alignright {
		float: none;
		margin: 0 auto 16px;
		max-width: 70%;
		display: block;
	}
}

/* Outline buttons: switch to white-on-image so they read against the darker overlay */
.is-style-outline .wp-block-button__link {
	color: #ffffff;
	box-shadow: inset 0 0 0 2px #ffffff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.is-style-outline .wp-block-button__link:hover {
	background: #ffffff;
	color: var(--db-color-primary);
	text-shadow: none;
}

/* iframe normalize (Covenant baseline) */
iframe[src*="youtube.com"],
iframe[src*="youtube-nocookie.com"],
iframe[src*="vimeo.com"] {
	aspect-ratio: 16 / 9;
	width: 100%;
	height: auto;
	border: 0;
	border-radius: var(--db-radius);
}

/* ---------- footer ---------- */
.site-footer {
	margin-top: clamp(40px, 6vw, 72px);
	background: var(--db-color-text);
	color: #d8d6cc;
	padding-block: clamp(28px, 4vw, 44px);
}
.site-footer a { color: #ecf2da; }
.site-footer__address h6 {
	color: #ffffff;
	margin: 0 0 8px;
	font-size: var(--db-step--1);
	letter-spacing: 0.1em;
	text-transform: uppercase;
}
.site-footer p { margin: 0; font-size: var(--db-step--1); line-height: 1.6; }
.site-footer__bottom {
	margin-top: 24px; padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	color: #a3a99a; font-size: var(--db-step--1);
	display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between;
}

/* ---------- blog list ---------- */
.post-list { display: grid; gap: clamp(20px, 3vw, 32px); }
.post-list article {
	background: var(--db-color-surface);
	border: 1px solid var(--db-color-border);
	border-radius: var(--db-radius-lg);
	padding: clamp(20px, 3vw, 28px);
}
.post-list article,
.post-list article * { color: var(--db-color-text); text-shadow: none; }
.post-list article a { color: var(--db-color-primary); }
.post-list article h2 { margin: 0 0 8px; font-size: var(--db-step-3); }
.post-list article h2 a { color: var(--db-color-text); text-decoration: none; }
.post-list article h2 a:hover { color: var(--db-color-primary); }
.post-list .entry-meta { margin-bottom: 12px; color: var(--db-color-muted); }
.read-more {
	display: inline-block; margin-top: 12px; font-weight: 600;
}

/* ---------- pagination ---------- */
.pagination {
	display: flex; gap: 8px; justify-content: center;
	margin-top: clamp(24px, 4vw, 40px);
}
.pagination a, .pagination span {
	padding: 8px 14px; border-radius: var(--db-radius);
	border: 1px solid var(--db-color-border);
	text-decoration: none; color: var(--db-color-text);
}
.pagination .current { background: var(--db-color-primary); color: var(--db-color-primary-ink); border-color: var(--db-color-primary); }

/* ---------- search form ---------- */
.search-form {
	display: flex; gap: 8px; max-width: var(--db-content-width); margin-inline: auto;
}
.search-form input[type="search"] {
	flex: 1; padding: 10px 14px;
	border: 1px solid var(--db-color-border); border-radius: var(--db-radius);
	font: inherit; background: var(--db-color-surface); color: var(--db-color-text);
}
.search-form button {
	background: var(--db-color-primary); color: var(--db-color-primary-ink);
	border: none; padding: 10px 18px; border-radius: var(--db-radius);
	font-weight: 600; cursor: pointer;
}

/* ---------- comments ---------- */
.comments-area { margin-top: clamp(32px, 5vw, 56px); padding-top: clamp(24px, 4vw, 40px); border-top: 1px solid var(--db-color-border); }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment { margin-bottom: 24px; padding: 16px; background: var(--db-color-surface); border-radius: var(--db-radius); border: 1px solid var(--db-color-border); }

/* ---------- utilities ---------- */
.alignwide { max-width: var(--db-wide-width); margin-inline: auto; }
.alignfull { width: 100vw; max-width: 100vw; margin-inline: calc(50% - 50vw); }
.screen-reader-text {
	border: 0; clip: rect(1px,1px,1px,1px); -webkit-clip-path: inset(50%); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important;
	width: 1px; word-wrap: normal !important;
}

/* ---------- print ---------- */
@media print {
	.site-header, .site-footer, .header-cta, .nav-toggle { display: none; }
	body { background: white; color: black; }
	a { color: black; text-decoration: underline; }
}
