/*
Theme Name: NICKAN
Theme URI: https://nickanconstruction.com/
Author: NICKAN Construction
Description: Block theme for NICKAN Construction — structural and civil engineering on the North Shore.
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nickan
*/

/* ---------- Base ---------- */
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--wp--preset--color--logo-blue);
	outline-offset: 2px;
}
img { height: auto; }
.screen-reader-text:focus { clip: auto !important; }

/* ---------- Header ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	border-bottom: 1px solid var(--wp--preset--color--border);
	background: rgba(255, 255, 255, 0.97);
	backdrop-filter: saturate(160%) blur(6px);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 0; } }
.site-header .wp-block-site-logo img { display: block; }
.site-header .nickan-tagline { color: var(--wp--preset--color--muted); font-size: 0.78rem; line-height: 1.2; margin: 0; }
.site-header .wp-block-navigation a { text-decoration: none; }
.site-header .wp-block-navigation a:hover { color: var(--wp--preset--color--accent); }
.site-header .wp-block-navigation__submenu-container {
	border: 1px solid var(--wp--preset--color--border) !important;
	border-radius: 8px;
	padding: 0.4rem 0 !important;
	box-shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
	min-width: 260px !important;
}
.site-header .wp-block-navigation__submenu-container a { padding: 0.5rem 1rem !important; }
.header-cta .wp-block-button__link { padding: 0.65rem 1.1rem; font-size: 0.95rem; }
@media (max-width: 900px) {
	.site-header .nickan-tagline { display: none; }
	.site-header .header-cta { display: none; }
}

/* ---------- Typography helpers ---------- */
.is-style-eyebrow {
	font-size: 0.8rem !important;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent);
	margin-bottom: 0.5rem !important;
}
.has-night-background-color .is-style-eyebrow,
.nickan-hero .is-style-eyebrow { color: #FF8A8A; }
.lead { font-size: var(--wp--preset--font-size--large); color: var(--wp--preset--color--muted); }
.has-night-background-color .lead { color: #C9CFDA; }
.muted { color: var(--wp--preset--color--muted); }

/* ---------- Hero ---------- */
.nickan-hero.wp-block-cover { min-height: min(86vh, 760px); }
.nickan-hero .wp-block-cover__inner-container { max-width: 1200px; }
.nickan-hero h1 { color: #fff; max-width: 15ch; text-wrap: balance; }
.nickan-hero p { color: #E5E9F0; max-width: 46ch; }
.nickan-hero .wp-block-button.is-style-outline .wp-block-button__link { color: #fff; border-color: rgba(255,255,255,0.8); background: transparent; }
.nickan-hero .wp-block-button.is-style-outline .wp-block-button__link:hover { background: rgba(255,255,255,0.12); }
.nickan-hero .wp-block-cover__background { background: linear-gradient(90deg, rgba(11,18,32,0.86) 0%, rgba(11,18,32,0.62) 45%, rgba(11,18,32,0.12) 100%) !important; opacity: 1 !important; }
@media (max-width: 781px) {
	.nickan-hero .wp-block-cover__background { background: linear-gradient(180deg, rgba(11,18,32,0.55) 0%, rgba(11,18,32,0.88) 70%) !important; }
	.nickan-hero.wp-block-cover { min-height: 640px; align-items: flex-end; }
}

/* Page title band */
.page-band { border-bottom: 1px solid var(--wp--preset--color--border); }
.page-band .wp-block-post-title { max-width: 22ch; text-wrap: balance; }
.page-band .wp-block-post-excerpt__excerpt { font-size: var(--wp--preset--font-size--large); color: var(--wp--preset--color--muted); max-width: 60ch; }

/* ---------- Cards ---------- */
.is-style-card {
	background: #fff;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	padding: clamp(1.25rem, 3vw, 2rem) !important;
	height: 100%;
	transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.is-style-card:hover { border-color: #D6D9DF; box-shadow: 0 14px 34px rgba(17,24,39,0.07); }
.is-style-card h3 { margin-top: 0.25rem; }
.is-style-card .card-link a { font-weight: 600; text-decoration: none; }
.is-style-card .card-link a::after { content: " \2192"; }
.service-num { font-family: var(--wp--preset--font-family--heading); font-weight: 800; color: var(--wp--preset--color--logo-blue); font-size: 0.9rem; letter-spacing: 0.08em; margin: 0; }
.wp-block-columns.equal-cards > .wp-block-column > .is-style-card { height: 100%; }

/* Credentials strip */
.cred-strip p { margin: 0; }
.cred-strip strong { display: block; font-family: var(--wp--preset--font-family--heading); font-size: 1.15rem; color: var(--wp--preset--color--ink); }
.cred-strip .wp-block-column { border-left: 3px solid var(--wp--preset--color--logo-red); padding-left: 1rem; }

/* Checklist */
.is-style-checks { list-style: none; padding-left: 0; }
.is-style-checks li { position: relative; padding-left: 1.9rem; margin-bottom: 0.6rem; }
.is-style-checks li::before {
	content: "";
	position: absolute; left: 0; top: 0.32em;
	width: 1.15rem; height: 1.15rem; border-radius: 50%;
	background: var(--wp--preset--color--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath d='M8.2 13.6 4.6 10l1.3-1.3 2.3 2.3 5.9-5.9 1.3 1.3z'/%3E%3C/svg%3E") center/0.95rem no-repeat;
}
.has-night-background-color .is-style-checks li::before { background-color: var(--wp--preset--color--logo-red); }

/* Steps */
.steps { counter-reset: step; }
.steps .step { position: relative; padding-top: 3.2rem !important; }
.steps .step::before {
	counter-increment: step;
	content: counter(step, decimal-leading-zero);
	position: absolute; top: 0; left: 0;
	font-family: var(--wp--preset--font-family--heading); font-weight: 800; font-size: 1.8rem;
	color: var(--wp--preset--color--logo-blue);
}
.steps .step h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.steps .step p { color: var(--wp--preset--color--muted); font-size: 0.98rem; margin-top: 0; }

/* Images and galleries */
.is-style-soft img, .soft-media img { border-radius: 10px; }
.project-grid.wp-block-gallery { --wp--style--gallery-gap-default: 14px; }
.project-grid.wp-block-gallery .wp-block-image img { border-radius: 8px; aspect-ratio: 4 / 3; object-fit: cover; }
.project-grid.wp-block-gallery .wp-block-image figcaption {
	border-radius: 0 0 8px 8px; font-size: 0.8rem; padding: 2.5rem 0.75rem 0.6rem; text-align: left;
	background: linear-gradient(0deg, rgba(11,18,32,0.75), rgba(11,18,32,0));
}

/* Tables */
.wp-block-table table { border-collapse: collapse; width: 100%; }
.wp-block-table th { background: var(--wp--preset--color--surface); text-align: left; font-weight: 700; }
.wp-block-table td, .wp-block-table th { border: 1px solid var(--wp--preset--color--border) !important; padding: 0.6rem 0.75rem !important; }
.projects-table td:nth-child(n+4), .projects-table th:nth-child(n+4) { text-align: center; }
.projects-table { overflow-x: auto; }
.projects-table table { min-width: 680px; }

/* FAQ */
.wp-block-details { border-bottom: 1px solid var(--wp--preset--color--border); }
.wp-block-details summary { font-weight: 700; font-family: var(--wp--preset--font-family--heading); cursor: pointer; list-style: none; position: relative; padding-right: 2rem; }
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after { content: "+"; position: absolute; right: 0.25rem; top: -0.1rem; font-size: 1.4rem; color: var(--wp--preset--color--accent); }
.wp-block-details[open] summary::after { content: "\2013"; }
.wp-block-details p { color: var(--wp--preset--color--muted); }

/* CTA band */
.cta-band h2 { color: #fff; }
.cta-band p { color: #C9CFDA; }

/* ---------- Footer ---------- */
.site-footer, .site-footer p, .site-footer li { color: #C9CFDA; font-size: 0.95rem; }
.site-footer h2, .site-footer h3 { color: #fff; font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; font-family: var(--wp--preset--font-family--body); font-weight: 700; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { color: #FF8A8A; text-decoration: underline; }
.site-footer ul { list-style: none; padding-left: 0; }
.site-footer li { margin-bottom: 0.45rem; }
.site-footer .footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); }
.site-footer .footer-bottom p { font-size: 0.85rem; color: #9AA3B2; }
.site-footer .footer-brand { color: #fff; font-family: var(--wp--preset--font-family--heading); font-weight: 800; font-size: 1.25rem; }

/* Mobile sticky action bar */
.mobile-bar { display: none; }
@media (max-width: 781px) {
	.mobile-bar {
		display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
		gap: 0; background: #fff; border-top: 1px solid var(--wp--preset--color--border);
		box-shadow: 0 -6px 20px rgba(17,24,39,0.08);
		padding-bottom: env(safe-area-inset-bottom);
	}
	.mobile-bar a {
		flex: 1; text-align: center; padding: 0.95rem 0.5rem; font-weight: 700; text-decoration: none;
		font-size: 1rem; color: var(--wp--preset--color--ink);
	}
	.mobile-bar a.mobile-bar__quote { background: var(--wp--preset--color--accent); color: #fff; }
	body { padding-bottom: 64px; }
}

/* ---------- Quote form ---------- */
.nickan-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.nickan-form .full { grid-column: 1 / -1; }
.nickan-form label, .nickan-form legend { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.35rem; color: var(--wp--preset--color--ink); }
.nickan-form .req { color: var(--wp--preset--color--accent); }
.nickan-form input[type=text], .nickan-form input[type=email], .nickan-form input[type=tel], .nickan-form select, .nickan-form textarea {
	width: 100%; box-sizing: border-box; padding: 0.75rem 0.85rem; border: 1px solid #CDD2DA; border-radius: 6px;
	font: inherit; font-size: 1rem; background: #fff; color: var(--wp--preset--color--ink);
}
.nickan-form textarea { min-height: 140px; resize: vertical; }
.nickan-form input:focus, .nickan-form select:focus, .nickan-form textarea:focus { border-color: var(--wp--preset--color--logo-blue); outline: 2px solid rgba(74,69,249,0.25); outline-offset: 0; }
.nickan-form fieldset { border: 0; padding: 0; margin: 0; }
.nickan-form .checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1rem; }
.nickan-form .checks label { font-weight: 400; display: flex; gap: 0.5rem; align-items: flex-start; margin: 0; }
.nickan-form .checks input { margin-top: 0.3rem; accent-color: var(--wp--preset--color--accent); }
.nickan-form .hint { font-size: 0.85rem; color: var(--wp--preset--color--muted); margin: 0.35rem 0 0; }
.nickan-form .hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.nickan-form button {
	background: var(--wp--preset--color--accent); color: #fff; border: 0; border-radius: 6px; cursor: pointer;
	padding: 0.95rem 1.6rem; font: inherit; font-weight: 700; font-size: 1.02rem;
}
.nickan-form button:hover { background: var(--wp--preset--color--accent-dark); }
.nickan-form-notice { padding: 1rem 1.25rem; border-radius: 8px; margin-bottom: 1.25rem; }
.nickan-form-notice.ok { background: #ECFDF3; border: 1px solid #A6F4C5; color: #05603A; }
.nickan-form-notice.err { background: #FEF3F2; border: 1px solid #FECDCA; color: #912018; }
@media (max-width: 640px) {
	.nickan-form, .nickan-form .checks { grid-template-columns: 1fr; }
}

/* Map */
.nickan-map iframe { width: 100%; height: 320px; border: 0; border-radius: 10px; display: block; }

/* Utility */
.no-underline a { text-decoration: none; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.is-style-card { transition: none; }
}

/* ---------- Layout fixes ---------- */
.wp-site-blocks > * + * { margin-block-start: 0; }
.wp-block-post-content > .alignfull { margin-block-start: 0; margin-block-end: 0; }
.nickan-hero .wp-block-cover__inner-container { width: 100%; max-width: 1200px; margin-inline: auto; }
.nickan-hero h1 { max-width: 19ch; }
.has-night-background-color .wp-block-button.is-style-outline .wp-block-button__link,
.has-night-background-color .wp-block-button.is-style-outline .wp-block-button__link:visited { color: #fff; border-color: rgba(255,255,255,0.7); background: transparent; }
.has-night-background-color .wp-block-button.is-style-outline .wp-block-button__link:hover { background: rgba(255,255,255,0.1); }
.nickan-hero .wp-block-cover__inner-container > * { margin-left: 0 !important; margin-right: 0 !important; }

/* Project grids: a real CSS grid (3 / 2 / 1 columns) */
.project-grid.wp-block-gallery.has-nested-images { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px !important; }
.project-grid.wp-block-gallery.has-nested-images.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-grid.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) { width: auto !important; margin: 0 !important; }
@media (max-width: 781px) { .project-grid.wp-block-gallery.has-nested-images { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .project-grid.wp-block-gallery.has-nested-images, .project-grid.wp-block-gallery.has-nested-images.columns-2 { grid-template-columns: 1fr; } }

@media (max-width: 781px) {
	body { padding-bottom: 0; }
	.site-footer { padding-bottom: calc(var(--wp--preset--spacing--40) + 64px) !important; }
}
.nickan-hero.wp-block-cover .wp-block-cover__inner-container { width: 100% !important; max-width: 1200px !important; margin-left: auto !important; margin-right: auto !important; }

/* ---------- One left edge for inner pages: wide grid 1200px, text columns 780px ---------- */
body:not(.page-template-page-landing) .page-band.is-layout-constrained > *,
body:not(.page-template-page-landing) .wp-block-post-content.is-layout-constrained > :where(p, ul, ol, h1, h2, h3, h4, h5, .wp-block-details, .wp-block-buttons, .wp-block-quote, .wp-block-separator, .wp-block-shortcode) {
	max-width: min(780px, 100%) !important;
	margin-left: max(0px, calc((100% - 1200px) / 2)) !important;
	margin-right: auto !important;
}
.wp-block-post-content > h2:not(:first-child) { margin-top: var(--wp--preset--spacing--60); }
.wp-block-post-content > h3:not(:first-child) { margin-top: var(--wp--preset--spacing--50); }
.wp-block-post-content > .wp-block-details + .wp-block-details { margin-top: 0; }
.project-grid.wp-block-gallery.has-nested-images.columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1024px) { .project-grid.wp-block-gallery.has-nested-images.columns-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 781px) { .project-grid.wp-block-gallery.has-nested-images.columns-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .project-grid.wp-block-gallery.has-nested-images.columns-4 { grid-template-columns: 1fr; } }

/* Hero photo credit */
.nickan-hero { position: relative; }
.nickan-hero .hero-credit { position: absolute; right: clamp(1rem, 3vw, 2rem); bottom: 0.9rem; margin: 0 !important; font-size: 0.78rem; color: rgba(255,255,255,0.78) !important; max-width: none; }
@media (max-width: 781px) { .nickan-hero .hero-credit { left: 1.25rem; right: auto; bottom: 0.6rem; } }
@media (max-width: 781px) { .nickan-hero .hero-credit { position: static; margin-top: 1.25rem !important; } }
