/*
Theme Name: BCID Voice
Theme URI: https://www.bcid.org/
Description: Accessible block theme for the Brooklyn Center for Independence of the Disabled. Built for WCAG 2.2 AA, with English, Spanish, Russian and French content.
Author: Titan Microsystems
Author URI: https://www.titanmicro.com/
Version: 1.0.0
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bcid-voice
*/

/* ---------- Base ---------- */

html { scroll-padding-top: 1rem; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { text-wrap: balance; font-optical-sizing: auto; }
p { text-wrap: pretty; }

/* Underlines that are easy to see but don't collide with letters */
a { text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.14em; }

/* ---------- Keyboard focus: a two-tone ring that shows on light and dark backgrounds ---------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--navy);
	outline-offset: 3px;
	box-shadow: 0 0 0 7px var(--wp--preset--color--yellow);
	border-radius: 4px;
}
.has-navy-background-color :focus-visible,
.has-navy-deep-background-color :focus-visible {
	outline-color: var(--wp--preset--color--yellow);
	box-shadow: 0 0 0 7px var(--wp--preset--color--navy-deep);
}

/* WordPress adds the "Skip to content" link automatically; make it large and obvious */
.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--navy) !important;
	color: var(--wp--preset--color--white) !important;
	font-size: 1.125rem !important;
	font-weight: 700;
	padding: 0.9rem 1.25rem !important;
	border-radius: 8px;
	text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Buttons ---------- */

.wp-block-button__link { min-height: 3rem; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
.wp-block-button.is-style-yellow .wp-block-button__link {
	background: var(--wp--preset--color--yellow);
	color: var(--wp--preset--color--ink);
}
.wp-block-button.is-style-yellow .wp-block-button__link:hover { background: #FFE38A; color: var(--wp--preset--color--ink); }
.has-navy-background-color .wp-block-button.is-style-outline .wp-block-button__link,
.has-navy-deep-background-color .wp-block-button.is-style-outline .wp-block-button__link {
	color: var(--wp--preset--color--white);
}
.has-navy-background-color .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--navy);
}

/* Text on dark bands */
.has-navy-background-color, .has-navy-deep-background-color { color: var(--wp--preset--color--white); }
.has-navy-background-color :where(h1, h2, h3, h4),
.has-navy-deep-background-color :where(h1, h2, h3, h4) { color: var(--wp--preset--color--yellow); }
.has-navy-background-color a:where(:not(.wp-element-button)),
.has-navy-deep-background-color a:where(:not(.wp-element-button)) { color: var(--wp--preset--color--white); }

/* Template parts and main sit flush; sections set their own padding */
.wp-site-blocks > * + * { margin-block-start: 0; }
.bcid-front .wp-block-post-content > * { margin-block: 0; }

/* ---------- Header ---------- */

.bcid-header-top { row-gap: 0.75rem; }
.bcid-header-top .wp-block-site-logo img { height: auto; }
.bcid-header-actions { row-gap: 0.75rem; }

.bcid-mainnav .wp-block-navigation-item__content {
	display: inline-flex; align-items: center;
	min-height: 2.75rem; padding: 0.4rem 0.85rem;
	text-decoration: none;
}
.bcid-mainnav .wp-block-navigation-item__content:hover { text-decoration: underline; text-decoration-thickness: 0.12em; }
.bcid-mainnav .current-menu-item > .wp-block-navigation-item__content,
.bcid-mainnav [aria-current="page"] { text-decoration: underline; text-decoration-color: var(--wp--preset--color--yellow); text-decoration-thickness: 0.2em; }
.bcid-mainnav .wp-block-navigation__responsive-container-open {
	color: var(--wp--preset--color--white);
	font-weight: 700; font-size: 1.125rem;
	min-height: 2.75rem; padding: 0.4rem 0.5rem; gap: 0.5rem;
}
.bcid-mainnav .wp-block-navigation__responsive-container-open::after { content: attr(aria-label); }
.bcid-mainnav .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--navy) !important;
	color: var(--wp--preset--color--white) !important;
	padding: 1.5rem;
}
.bcid-mainnav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content { font-size: 1.375rem; }

/* ---------- Language switcher ---------- */

.bcid-lang ul { list-style: none; margin: 0; padding: 4px; display: flex; flex-wrap: wrap; gap: 2px; border: 2px solid var(--wp--preset--color--navy); border-radius: 999px; }
.bcid-lang a {
	display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0.35rem 1rem;
	border-radius: 999px; font-weight: 700; font-size: 1rem; text-decoration: none;
	color: var(--wp--preset--color--navy);
}
.bcid-lang a:hover { background: var(--wp--preset--color--tint); text-decoration: underline; }
.bcid-lang a[aria-current="true"] { background: var(--wp--preset--color--navy); color: var(--wp--preset--color--white); }
.bcid-lang :lang(ru) { font-family: "Golos Text", var(--wp--preset--font-family--body); }

/* ---------- Hero ---------- */

.bcid-hero h1 mark {
	background: linear-gradient(transparent 58%, var(--wp--preset--color--yellow) 58%) !important;
	color: inherit; padding: 0 0.12em;
	-webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.bcid-hero .wp-block-image img { border-radius: 28px 28px 28px 0; width: 100%; height: 100%; object-fit: cover; }
.bcid-hero .wp-block-image { height: 100%; display: flex; flex-direction: column; }
.bcid-hero .wp-block-image figcaption { margin-top: 0.6rem; }

/* ---------- Cards (whole card is clickable; only the heading link is announced) ---------- */

.bcid-card { position: relative; border-radius: 20px; height: 100%; box-sizing: border-box; }
.bcid-card h3 a { text-decoration: none; color: inherit; }
.bcid-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 20px; }
.bcid-card:hover h3 a { text-decoration: underline; text-decoration-thickness: 0.1em; }
.bcid-card:has(a:focus-visible) { outline: 3px solid var(--wp--preset--color--navy); outline-offset: 3px; box-shadow: 0 0 0 7px var(--wp--preset--color--yellow); }
.bcid-card a:focus-visible { outline: none; box-shadow: none; }
.bcid-card.has-navy-background-color:has(a:focus-visible) { outline-color: var(--wp--preset--color--yellow); box-shadow: 0 0 0 7px var(--wp--preset--color--navy-deep); }

/* Service icons: chosen with an extra CSS class on the card, e.g. "bcid-card bcid-icon-housing" */
.bcid-card[class*="bcid-icon-"]::before {
	content: ""; display: block; width: 3.25rem; height: 3.25rem; border-radius: 14px;
	background-color: var(--wp--preset--color--yellow);
	background-repeat: no-repeat; background-position: center; background-size: 1.75rem;
}
.bcid-icon-benefits::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='4' width='12' height='17' rx='2'/%3E%3Cpath d='M9 4h6v3H9zM9 11h6M9 15h4'/%3E%3C/svg%3E"); }
.bcid-icon-housing::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-7 9 7'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3Cpath d='M10 20v-6h4v6'/%3E%3C/svg%3E"); }
.bcid-icon-door::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 21V4h9l3 2v15'/%3E%3Cpath d='M3 21h18'/%3E%3Ccircle cx='13.5' cy='13' r='0.8'/%3E%3C/svg%3E"); }
.bcid-icon-tax::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='3' width='14' height='18' rx='2'/%3E%3Cpath d='M8 7h8M8 11h2M14 11h2M8 15h2M14 15h2M8 18h8'/%3E%3C/svg%3E"); }
.bcid-icon-peers::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='9' r='2.5'/%3E%3Cpath d='M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6'/%3E%3Cpath d='M15 14.5c.6-.3 1.3-.5 2-.5 2.8 0 5 2.2 5 5'/%3E%3C/svg%3E"); }
.bcid-icon-phone::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E"); }
.bcid-icon-advocacy::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10v4h3l6 4V6L6 10H3z'/%3E%3Cpath d='M16 9a4 4 0 0 1 0 6M19 6a8 8 0 0 1 0 12'/%3E%3C/svg%3E"); }

/* ---------- News lists ---------- */

.bcid-newslist .wp-block-post { padding-block: 1.25rem; border-bottom: 2px solid var(--wp--preset--color--line); }
.bcid-newslist .wp-block-post:first-child { padding-top: 0; }
.bcid-newslist .wp-block-post:last-child { border-bottom: 0; }
.bcid-newslist .wp-block-post-title a { text-decoration: none; }
.bcid-newslist .wp-block-post-title a:hover { text-decoration: underline; }
.bcid-feature-story .wp-block-image img { border-radius: 20px; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }

/* ---------- Upcoming events: the whole section hides itself when nothing is scheduled ---------- */

.bcid-upcoming-section:has(.bcid-events--empty) { display: none; }
.bcid-events { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1.25rem; }
.bcid-event { position: relative; display: flex; gap: 1.1rem; align-items: flex-start; background: var(--wp--preset--color--white); border-radius: 20px; padding: 1.35rem; }
.bcid-event__date { flex: 0 0 auto; width: 4.6rem; padding: 0.6rem 0; border-radius: 14px; background: var(--wp--preset--color--navy); color: var(--wp--preset--color--white); display: flex; flex-direction: column; align-items: center; font-weight: 800; line-height: 1.1; }
.bcid-event__month { font-size: 0.95rem; color: var(--wp--preset--color--yellow); text-transform: uppercase; letter-spacing: 0.04em; }
.bcid-event__day { font-family: var(--wp--preset--font-family--display); font-size: 1.75rem; }
.bcid-event__title { margin: 0; font-family: var(--wp--preset--font-family--body); font-size: 1.25rem; font-weight: 800; letter-spacing: 0; line-height: 1.3; }
.bcid-event__title a { text-decoration: none; }
.bcid-event__title a::after { content: ""; position: absolute; inset: 0; border-radius: 20px; }
.bcid-event:hover .bcid-event__title a { text-decoration: underline; }
.bcid-event__meta { margin: 0.25rem 0 0; color: var(--wp--preset--color--muted); font-size: 1rem; }

/* ---------- Inner pages and news articles: calmer heading sizes than the home page ---------- */

.bcid-prose h2 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem); margin-block-start: 2.25rem; }
.bcid-prose h3 { font-size: clamp(1.375rem, 1.25rem + 0.6vw, 1.625rem); margin-block-start: 1.75rem; }
.bcid-prose h4 { font-size: 1.25rem; }
.bcid-prose > :first-child { margin-block-start: 0; }
.bcid-prose { overflow-wrap: anywhere; }
.bcid-prose img { height: auto; }

/* ---------- Content details ---------- */

.wp-block-details { border: 2px solid var(--wp--preset--color--line); border-radius: 14px; padding: 0; }
.wp-block-details summary { padding: 1rem 1.25rem; font-weight: 800; font-size: var(--wp--preset--font-size--medium); color: var(--wp--preset--color--navy); cursor: pointer; min-height: 2.75rem; }
.wp-block-details[open] summary { border-bottom: 2px solid var(--wp--preset--color--line); }
.wp-block-details > :not(summary) { margin-inline: 1.25rem; }
.wp-block-details > :last-child { margin-bottom: 1.25rem; }

/* Embedded maps and donation forms scale down on phones */
.entry-content iframe, .wp-block-post-content iframe { max-width: 100%; border: 0; }
.bcid-embed iframe { width: 100%; }

/* Tables of legacy content scroll inside their own box instead of widening the page */
.wp-block-post-content table { display: block; overflow-x: auto; max-width: 100%; }

/* ---------- Forms (Contact Form 7) ---------- */

.wpcf7 label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 input[type="tel"], .wpcf7 textarea, .wpcf7 select {
	width: 100%; max-width: 36rem; box-sizing: border-box; font: inherit; font-size: 1.125rem;
	padding: 0.7rem 0.85rem; border: 2px solid var(--wp--preset--color--muted); border-radius: 10px;
	background: var(--wp--preset--color--white); color: var(--wp--preset--color--ink);
}
.wpcf7 textarea { min-height: 10rem; }
.wpcf7 input[type="submit"] {
	font: inherit; font-weight: 700; font-size: 1.125rem; min-height: 3rem; padding: 0.8rem 1.75rem;
	border: 0; border-radius: 999px; background: var(--wp--preset--color--navy); color: var(--wp--preset--color--white); cursor: pointer;
}
.wpcf7 input[type="submit"]:hover { background: var(--wp--preset--color--navy-deep); }
.wpcf7 .wpcf7-not-valid { border-color: #B3261E; }
.wpcf7 .wpcf7-not-valid-tip { color: #B3261E; font-weight: 700; font-size: 1rem; }
.wpcf7 form .wpcf7-response-output { border-radius: 10px; padding: 0.75rem 1rem; margin: 1rem 0 0; }

/* ---------- Footer ---------- */

.bcid-footer a { text-decoration-color: rgba(255, 255, 255, 0.6); }
.bcid-footer .wp-block-heading { color: var(--wp--preset--color--yellow); }
.bcid-footer-fine { color: #D3D9EA; }
.bcid-footer > .bcid-footer-fine { max-width: var(--wp--style--global--wide-size); }
.bcid-footer .wp-block-separator { border-color: #3A4A7A; color: #3A4A7A; opacity: 1; }
.bcid-footer-fine a { color: #D3D9EA !important; }

/* ---------- Phone width ---------- */

@media (max-width: 781px) {
	.bcid-header-top { justify-content: center !important; }
	.bcid-lang ul { border-radius: 1.5rem; justify-content: center; }
	.bcid-lang a { padding: 0.35rem 0.7rem; font-size: 0.95rem; }
	.bcid-header-actions { justify-content: center !important; }
	.bcid-hero .wp-block-image img { aspect-ratio: 4 / 3; height: auto; }
}
