/*
Theme Name: Huntley Directory Theme
Theme URI: https://huntleydigital.com/
Author: Huntley Digital
Author URI: https://huntleydigital.com/
Description: A fast, accessible, SEO-conscious companion theme for the Huntley Directory plugin. Designed for directories, local business sites, membership sites, dealer locators, and service marketplaces.
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: huntley-directory-theme
Tags: directory, business, custom-logo, custom-menu, featured-images, accessibility-ready, wide-blocks, blog
*/

:root {
	--hdt-bg: #ffffff;
	--hdt-surface: #f7f9fc;
	--hdt-surface-2: #eef3f8;
	--hdt-text: #152033;
	--hdt-muted: #5d6979;
	--hdt-border: #dfe5ec;
	--hdt-accent: #1769aa;
	--hdt-accent-dark: #0f4f84;
	--hdt-success: #16794c;
	--hdt-warning: #9a6700;
	--hdt-radius: 14px;
	--hdt-shadow: 0 10px 30px rgba(21, 32, 51, .08);
	--hdt-content: 760px;
	--hdt-wide: 1200px;
	--hdt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--hdt-bg);
	color: var(--hdt-text);
	font-family: var(--hdt-font);
	font-size: 17px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--hdt-accent); text-underline-offset: .16em; }
a:hover { color: var(--hdt-accent-dark); }
button, input, select, textarea { font: inherit; }
button, input[type="submit"] { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--hdt-accent) 55%, white); outline-offset: 3px; }
::selection { background: color-mix(in srgb, var(--hdt-accent) 20%, white); }

h1, h2, h3, h4, h5, h6 { color: var(--hdt-text); line-height: 1.18; letter-spacing: -.018em; margin: 0 0 .65em; }
h1 { font-size: clamp(2.1rem, 5vw, 4.4rem); }
h2 { font-size: clamp(1.65rem, 3vw, 2.6rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.65rem); }
p, ul, ol { margin-top: 0; }

.hdt-container { width: min(calc(100% - 40px), var(--hdt-wide)); margin-inline: auto; }
.hdt-content-width { width: min(calc(100% - 40px), var(--hdt-content)); margin-inline: auto; }
.hdt-site-main { min-height: 55vh; }
.hdt-section { padding: clamp(48px, 7vw, 90px) 0; }
.hdt-section--muted { background: var(--hdt-surface); border-block: 1px solid var(--hdt-border); }
.hdt-section-heading { display: flex; gap: 24px; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.hdt-section-heading p { color: var(--hdt-muted); max-width: 650px; margin: 0; }

.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; }
.screen-reader-text:focus { background: #fff; clip: auto !important; clip-path: none; color: var(--hdt-text); display: block; font-size: 14px; height: auto; left: 10px; padding: 12px 16px; top: 10px; width: auto; z-index: 100000; border-radius: 6px; box-shadow: var(--hdt-shadow); }

/* Header */
.hdt-site-header { position: relative; z-index: 50; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--hdt-border); }
.hdt-header-inner { min-height: 76px; display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; }
.hdt-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--hdt-text); text-decoration: none; font-weight: 800; font-size: 1.14rem; letter-spacing: -.02em; }
.hdt-brand img, .custom-logo { max-height: 48px; width: auto; }
.hdt-primary-nav { justify-self: end; }
.hdt-primary-nav ul { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.hdt-primary-nav a { display: block; padding: 10px 12px; color: var(--hdt-text); text-decoration: none; font-weight: 650; font-size: .94rem; border-radius: 8px; }
.hdt-primary-nav a:hover, .hdt-primary-nav .current-menu-item > a, .hdt-primary-nav .current_page_item > a { background: var(--hdt-surface-2); color: var(--hdt-accent-dark); }
.hdt-header-actions { display: flex; align-items: center; gap: 9px; }
.hdt-header-link { color: var(--hdt-text); text-decoration: none; font-weight: 700; font-size: .9rem; }
.hdt-menu-toggle { display: none; appearance: none; background: #fff; color: var(--hdt-text); border: 1px solid var(--hdt-border); border-radius: 9px; padding: 9px 12px; font-weight: 700; }

.hdt-button, .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	border: 1px solid var(--hdt-accent);
	border-radius: 9px;
	background: var(--hdt-accent);
	color: #fff;
	font-weight: 750;
	text-decoration: none;
	line-height: 1.2;
	transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.hdt-button:hover, .wp-block-button__link:hover { background: var(--hdt-accent-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(21, 32, 51, .12); }
.hdt-button--ghost { background: transparent; color: var(--hdt-accent); }
.hdt-button--ghost:hover { color: #fff; }

/* Home */
.hdt-hero { overflow: hidden; position: relative; padding: clamp(64px, 10vw, 128px) 0 clamp(50px, 8vw, 96px); background: linear-gradient(135deg, #f9fbfd 0%, #edf5fb 58%, #f8fafc 100%); border-bottom: 1px solid var(--hdt-border); }
.hdt-hero::after { content: ""; position: absolute; width: 440px; height: 440px; right: -180px; top: -180px; border-radius: 50%; background: color-mix(in srgb, var(--hdt-accent) 10%, transparent); }
.hdt-hero-content { position: relative; z-index: 1; max-width: 900px; }
.hdt-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 6px 10px; background: #fff; border: 1px solid var(--hdt-border); border-radius: 999px; color: var(--hdt-accent-dark); font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hdt-hero h1 { max-width: 850px; margin-bottom: 18px; }
.hdt-hero-lead { max-width: 740px; color: var(--hdt-muted); font-size: clamp(1.08rem, 2vw, 1.3rem); }
.hdt-hero-search { margin-top: 32px; display: grid; grid-template-columns: minmax(180px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr) auto; gap: 10px; padding: 10px; background: #fff; border: 1px solid var(--hdt-border); border-radius: 14px; box-shadow: var(--hdt-shadow); }
.hdt-hero-search input, .hdt-hero-search select { width: 100%; min-height: 48px; border: 1px solid var(--hdt-border); border-radius: 8px; background: #fff; color: var(--hdt-text); padding: 9px 12px; }
.hdt-stats { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 10px 24px; color: var(--hdt-muted); font-size: .95rem; }
.hdt-stats strong { color: var(--hdt-text); }
.hdt-category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.hdt-category-card { position: relative; min-height: 190px; overflow: hidden; display: flex; align-items: end; padding: 20px; border: 1px solid var(--hdt-border); border-radius: var(--hdt-radius); background: var(--hdt-surface); color: var(--hdt-text); text-decoration: none; }
.hdt-category-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hdt-category-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(15, 24, 38, .82), rgba(15, 24, 38, .05) 75%); }
.hdt-category-card--no-image::after { background: linear-gradient(135deg, color-mix(in srgb, var(--hdt-accent) 12%, white), #fff); }
.hdt-category-card span { position: relative; z-index: 1; color: #fff; font-size: 1.12rem; font-weight: 800; }
.hdt-category-card--no-image span { color: var(--hdt-text); }
.hdt-category-card small { display: block; font-size: .82rem; font-weight: 600; opacity: .85; }
.hdt-category-card:hover { transform: translateY(-2px); box-shadow: var(--hdt-shadow); }
.hdt-home-cta { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; padding: clamp(28px, 5vw, 52px); border-radius: 20px; background: var(--hdt-text); color: #fff; }
.hdt-home-cta h2, .hdt-home-cta p { color: #fff; }
.hdt-home-cta p { opacity: .82; margin: 0; max-width: 680px; }

/* Generic content */
.hdt-page-hero, .hdt-archive-hero { padding: 48px 0 24px; }
.hdt-page-hero h1, .hdt-archive-hero h1 { font-size: clamp(2rem, 4vw, 3.4rem); }
.hdt-entry { width: min(calc(100% - 40px), var(--hdt-content)); margin: 0 auto; padding: 40px 0 72px; }
.hdt-entry--wide { width: min(calc(100% - 40px), var(--hdt-wide)); }
.hdt-entry-content > * { max-width: 100%; }
.hdt-entry-content > .alignwide { width: min(100vw - 40px, var(--hdt-wide)); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.hdt-entry-content > .alignfull { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
.hdt-entry-content table { width: 100%; border-collapse: collapse; }
.hdt-entry-content th, .hdt-entry-content td { padding: 10px; border: 1px solid var(--hdt-border); text-align: left; }
.hdt-entry-content blockquote { margin-inline: 0; padding: 14px 20px; border-left: 4px solid var(--hdt-accent); background: var(--hdt-surface); }
.hdt-post-meta { color: var(--hdt-muted); font-size: .9rem; margin-bottom: 24px; }
.hdt-featured-media { margin-bottom: 26px; }
.hdt-featured-media img { width: 100%; border-radius: var(--hdt-radius); }
.hdt-post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-bottom: 70px; }
.hdt-post-card { overflow: hidden; border: 1px solid var(--hdt-border); border-radius: var(--hdt-radius); background: #fff; }
.hdt-post-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.hdt-post-card__body { padding: 20px; }
.hdt-post-card h2 { font-size: 1.35rem; }
.hdt-post-card h2 a { color: var(--hdt-text); text-decoration: none; }
.hdt-post-card p { color: var(--hdt-muted); }

/* Breadcrumbs */
.hdt-breadcrumbs { padding: 20px 0 0; color: var(--hdt-muted); font-size: .86rem; }
.hdt-breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.hdt-breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: #a3adba; }
.hdt-breadcrumbs a { color: inherit; text-decoration: none; }

/* Forms */
.hdt-form-field label { display: block; margin-bottom: 5px; font-weight: 700; }
input[type="text"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
	max-width: 100%; border: 1px solid #cbd4df; border-radius: 8px; background: #fff; color: var(--hdt-text); padding: 10px 12px;
}
textarea { min-height: 120px; resize: vertical; }

/* Footer */
.hdt-site-footer { margin-top: 72px; background: #0f1826; color: #cbd5e1; }
.hdt-footer-widgets { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 32px; padding: 52px 0 36px; }
.hdt-footer-widgets h2, .hdt-footer-widgets h3 { color: #fff; font-size: 1.05rem; }
.hdt-footer-widgets a { color: #e2e8f0; }
.hdt-footer-bottom { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 24px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: .88rem; }
.hdt-footer-menu ul { display: flex; gap: 18px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.hdt-footer-menu a { color: #e2e8f0; text-decoration: none; }

/* WordPress core */
.wp-caption { max-width: 100%; }
.wp-caption-text { color: var(--hdt-muted); font-size: .88rem; }
.gallery-caption { color: var(--hdt-muted); }
.bypostauthor { display: block; }
.sticky { display: block; }
.alignleft { float: left; margin: 0 24px 16px 0; }
.alignright { float: right; margin: 0 0 16px 24px; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }

/* Comments */
.hdt-comments { width: min(calc(100% - 40px), var(--hdt-content)); margin: 0 auto 70px; }
.comment-list { list-style: none; padding: 0; }
.comment-body { padding: 18px 0; border-top: 1px solid var(--hdt-border); }

@media (max-width: 980px) {
	.hdt-header-inner { grid-template-columns: 1fr auto; }
	.hdt-menu-toggle { display: inline-flex; }
	.hdt-primary-nav { display: none; grid-column: 1 / -1; justify-self: stretch; padding-bottom: 14px; }
	.hdt-primary-nav.is-open { display: block; }
	.hdt-primary-nav ul { flex-direction: column; align-items: stretch; }
	.hdt-header-actions .hdt-header-link { display: none; }
	.hdt-hero-search { grid-template-columns: 1fr 1fr; }
	.hdt-category-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
	.hdt-post-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 640px) {
	body { font-size: 16px; }
	.hdt-container, .hdt-content-width, .hdt-entry { width: min(calc(100% - 28px), var(--hdt-wide)); }
	.hdt-header-inner { min-height: 66px; gap: 10px; }
	.hdt-header-actions .hdt-button { display: none; }
	.hdt-hero { padding-top: 54px; }
	.hdt-hero-search, .hdt-category-grid, .hdt-post-grid, .hdt-footer-widgets, .hdt-home-cta { grid-template-columns: 1fr; }
	.hdt-section-heading, .hdt-footer-bottom { align-items: flex-start; flex-direction: column; }
	.hdt-category-card { min-height: 150px; }
	.alignleft, .alignright { float: none; margin: 0 auto 18px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
