/* Casa da Lusofonia — component styles beyond theme.json.
   Faithful replica of casadalusofonia.net (frozen Tokyo-2020 archive):
   Lato type, sky-blue header (#B3E5FC), blue footer (#0288D1),
   grey intro box, circular committee flags. */

/* ---------- Header ----------
 * The source header is FIXED to the top of the viewport (position:fixed; top:0;
 * z-index high), so it stays put while the page scrolls; the source offsets the
 * page below it with a body margin. Here the header is the root-level
 * `header.wp-block-template-part`; fix it, then push the first in-flow sibling
 * (banner / main) down by the header height so the fixed header doesn't overlap
 * the content. --casa-header-h matches the source 70px. (A padding-top on
 * .wp-site-blocks is overridden by WP's equal-specificity root-padding rule, so
 * the offset lives on the sibling instead.) */
:root {
	--casa-header-h: 70px;
}

.wp-site-blocks > header.wp-block-template-part {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 301;
	margin-top: 0;
}

/* Clear the fixed header: the block right after it starts at the header's
 * bottom edge, flush (matching the source's banner-under-header layout). */
.wp-site-blocks > header.wp-block-template-part + * {
	margin-top: var(--casa-header-h);
}

/* Logged-in front end: WP's admin toolbar is itself position:fixed; top:0, so it
 * would sit ON TOP of our fixed header. WP normally clears it with html{margin-top}
 * but that can't move a fixed element, so only the FIXED header needs the explicit
 * offset to clear the bar (32px desktop / 46px below WP's 782px breakpoint, where the
 * bar is also fixed). The in-flow sibling does NOT get bumped: WP's html{margin-top}
 * already shifts the whole in-flow container down by the same amount, so its 70px
 * header-clearance is still correct — adding the bar height here double-counts it and
 * opens a gap. Anonymous visitors have no .admin-bar class, so the public site is
 * unaffected. */
body.admin-bar .wp-site-blocks > header.wp-block-template-part {
	top: 32px;
}
@media screen and (max-width: 782px) {
	body.admin-bar .wp-site-blocks > header.wp-block-template-part {
		top: 46px;
	}
}

/* The header group is a constrained (block-flow) layout, so its 50px-tall inner
 * content flows at top:0 inside the 70px bar, dumping all slack at the bottom.
 * The source vertically centres it (10px top + 50px + 10px bottom). Make the
 * header a flex row and centre its single child; .casa-header-inner keeps its
 * own margin-inline:auto to stay horizontally centred within 1200px. */
.casa-header {
	display: flex;
	align-items: center;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	min-height: var(--casa-header-h);
}

.casa-header-inner {
	width: 100%;
	max-width: 1200px;
	margin-inline: auto;
	gap: 1rem 2rem;
}

.casa-logo {
	margin: 0;
}

.casa-logo img {
	display: block;
	height: auto;
}

.casa-nav-wrap {
	gap: 0.5rem 1.5rem;
}

/* Primary navigation (dynamic casa/nav block) */
.casa-nav {
	font-family: var(--wp--preset--font-family--sans);
	font-size: 0.95rem;
	font-weight: 400;
}

.casa-nav .casa-nav-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.casa-nav .casa-nav-item {
	position: relative;
	margin: 0;
}

.casa-nav .casa-nav-item > a {
	display: inline-block;
	color: var(--wp--preset--color--neutral-900);
	text-decoration: none;
	padding: 0.25rem 0;
}

.casa-nav .casa-nav-item > a:hover {
	color: var(--wp--preset--color--primary);
}

/* Active item: the source bolds the selected menu item, keeping its grey
 * colour (it does NOT recolour it). Mirror that — weight only. */
.casa-nav .casa-nav-item.current-menu-item > a {
	font-weight: 700;
}

/* Sobre nós submenu */
.casa-nav .casa-subnav {
	position: absolute;
	left: 0;
	top: 100%;
	z-index: 20;
	display: none;
	margin: 0;
	padding: 0.25rem 0;
	list-style: none;
	background-color: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
	min-width: 200px;
}

.casa-nav .casa-nav-has-sub:hover > .casa-subnav,
.casa-nav .casa-nav-has-sub:focus-within > .casa-subnav {
	display: block;
}

.casa-nav .casa-subnav .casa-nav-item > a,
.casa-nav .casa-subnav > li > a {
	display: block;
	padding: 0.5rem 1rem;
	white-space: nowrap;
}

/* ---------- Language switcher (PT / EN / JA flags) ----------
 * Rendered by the dynamic casa/lang-switcher block as a bare wp-block-group
 * (no core "is-layout-flex" class), so the flex layout must be declared here. */
.casa-lang {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.45rem !important;
	margin-left: 0.5rem;
}

.casa-lang .casa-lang-flag {
	margin: 0;
}

.casa-lang .casa-lang-flag a {
	display: inline-flex;
	align-items: center;
	line-height: 1;
	opacity: 0.7;
	transition: opacity 0.15s ease;
}

.casa-lang .casa-lang-flag a:hover,
.casa-lang .casa-lang-flag.current-lang a {
	opacity: 1;
}

.casa-lang .casa-lang-flag img {
	display: block;
	width: 22px;
	height: auto;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 2px;
}

/* ---------- Banner carousel ----------
 * Faithful replica of the source media-gallery carousel: a full-width 300px
 * strip that cross-fades between its images every 2s. Slides are stacked
 * absolutely; only .is-active is opaque, the rest fade out beneath it. Used by
 * casa/banner on the homepage (2 images) and interior pages (3 images). The
 * gap between header and banner is handled by the fixed-header rules above
 * (the block after the header gets margin-top:0). */
.casa-banner {
	position: relative;
	width: 100%;
	height: 300px;
	overflow: hidden;
	margin-top: 0;
	background: var(--wp--preset--color--neutral-100);
}

.casa-banner-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 0.8s ease-in-out;
}

.casa-banner-slide.is-active {
	opacity: 1;
}

.casa-banner-slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* ---------- Intro section ----------
 * These alignfull sections used core "constrained" layout (contentSize 1170px)
 * to centre their children; casa/home emits bare groups, so centre them here. */
.casa-intro-section > *,
.casa-committees > * {
	max-width: 1170px;
	margin-inline: auto;
}

.casa-title {
	color: #000;
	font-weight: 700;
	margin-bottom: 0.25rem;
}

.casa-subtitle {
	color: var(--wp--preset--color--neutral-700);
	font-weight: 400;
	margin-top: 0;
	margin-bottom: 0;
}

/* casa/home renders wp:columns markup dynamically, so core block-library
 * layout CSS is never enqueued — declare the two-column flex layout here. */
.casa-intro-cols {
	display: flex;
	flex-wrap: nowrap;
	gap: 2rem;
	align-items: flex-start;
}

.casa-intro-cols > .wp-block-column {
	min-width: 0;
}

.casa-intro-text {
	font-size: 0.95rem;
	line-height: 1.7;
	color: var(--wp--preset--color--neutral-900);
}

.casa-intro-text p {
	margin: 0 0 1rem;
}

.casa-intro-text p:last-child {
	margin-bottom: 0;
}

.casa-intro-photos {
	display: flex;
	flex-direction: row;
	gap: 1rem;
}

.casa-intro-photos .wp-block-image {
	margin: 0;
	flex: 1;
}

.casa-intro-photos img {
	width: 100%;
	height: 260px;
	object-fit: cover;
	display: block;
}

/* ---------- Committee flag grid ---------- */
.casa-committees-title {
	color: #000;
	font-weight: 700;
}

/* Committee flag grid — casa/home emits bare wp-block-groups, so the grid /
 * per-cell flex layouts (formerly core "is-layout-grid"/"is-layout-flex")
 * are declared here. Mirrors the old minimumColumnWidth:140px grid. */
.casa-flags-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 1.5rem 1rem;
	justify-items: center;
}

.casa-flag {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	align-items: center;
}

.casa-flag-img {
	margin: 0;
}

.casa-flag-img img {
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.casa-flag-name {
	font-size: 0.9rem;
	color: var(--wp--preset--color--neutral-900);
	margin: 0;
}

/* ---------- Footer ---------- */
.casa-footer {
	color: #fff;
}

.casa-copyright {
	margin: 0;
	font-size: 0.85rem;
}

.casa-footer a {
	color: #fff;
	text-decoration: underline;
}

/* ---------- Interior pages ---------- */
.casa-hero-band {
	min-height: 220px;
}

.casa-hero-band .wp-block-cover__inner-container {
	min-height: 1px;
}

.casa-breadcrumb-bar {
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	padding-top: 0.6rem;
	padding-bottom: 0.6rem;
}

.casa-breadcrumb {
	font-size: 0.8rem;
	color: var(--wp--preset--color--neutral-700);
	line-height: 1.4;
}

.casa-breadcrumb-link {
	color: var(--wp--preset--color--neutral-700);
	text-decoration: none;
}

.casa-breadcrumb-link:hover {
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
}

.casa-breadcrumb-current {
	color: var(--wp--preset--color--neutral-900);
	font-weight: 700;
}

.casa-breadcrumb-sep {
	color: var(--wp--preset--color--neutral-500);
	margin: 0 0.15rem;
}

.casa-interior .casa-page-title {
	margin-bottom: 0.5rem;
}

.casa-prose :where(h2, h3) {
	margin-top: 1.75rem;
}

/* Google Map embed (Localização) */
.casa-map-embed {
	margin-top: 1.5rem;
}

.casa-map-embed iframe {
	width: 100%;
	min-height: 420px;
	border: 0;
	display: block;
}

/* ---------- Notícias list (single-card layout) ---------- */
.casa-news-card {
	max-width: 560px;
	margin: 0 auto;
	text-align: center;
}

.casa-news-card .wp-block-post-featured-image {
	margin-bottom: 1rem;
}

.casa-news-card .wp-block-post-featured-image img {
	width: 100%;
	height: 260px;
	object-fit: cover;
	display: block;
}

.casa-news-card .wp-block-post-title {
	font-size: 1.25rem;
	line-height: 1.3;
	margin: 0 0 1.25rem;
}

.casa-news-card .wp-block-post-title a {
	color: var(--wp--preset--color--neutral-900);
	text-decoration: none;
}

.casa-news-card .wp-block-post-title a:hover {
	color: var(--wp--preset--color--primary);
}

.casa-btn-outline {
	display: inline-block;
	padding: 0.5rem 1.5rem;
	border: 1px solid var(--wp--preset--color--primary);
	border-radius: 0.25rem;
	color: var(--wp--preset--color--primary);
	background: transparent;
	font-size: 0.9rem;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.casa-btn-outline:hover {
	background: var(--wp--preset--color--primary);
	color: #fff;
}

/* ---------- Galeria ---------- */
.casa-galeria.wp-block-gallery {
	gap: 0.75rem;
}

.casa-galeria .wp-block-image img {
	width: 100%;
	height: 220px;
	object-fit: cover;
	display: block;
	border-radius: 2px;
}

/* ---------- Forms (Newsletter / Contato) ---------- */
.casa-form {
	max-width: 560px;
	margin: 1.5rem auto 0;
}

.casa-form fieldset {
	border: 0;
	padding: 0;
	margin: 0;
}

.casa-form legend {
	font-size: 1.5rem;
	font-weight: 700;
	font-family: var(--wp--preset--font-family--heading);
	margin-bottom: 0.5rem;
	padding: 0;
}

.casa-form-desc {
	color: var(--wp--preset--color--neutral-700);
	margin: 0 0 1.25rem;
}

.casa-field {
	margin-bottom: 1rem;
}

.casa-field label {
	display: block;
	font-size: 0.9rem;
	font-weight: 700;
	margin-bottom: 0.35rem;
	color: var(--wp--preset--color--neutral-900);
}

.casa-req {
	color: var(--wp--preset--color--accent-2);
	font-weight: 400;
	font-size: 0.8rem;
}

.casa-field input,
.casa-field textarea {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--wp--preset--color--neutral-300);
	border-radius: 0.25rem;
	font: inherit;
	font-size: 0.95rem;
	background: #fff;
	color: var(--wp--preset--color--neutral-900);
}

.casa-field input:focus,
.casa-field textarea:focus {
	outline: 2px solid var(--wp--preset--color--primary-light);
	border-color: var(--wp--preset--color--primary);
}

.casa-btn {
	display: inline-block;
	padding: 0.7rem 1.75rem;
	background: var(--wp--preset--color--primary);
	color: #fff;
	border: 0;
	border-radius: 0.25rem;
	font: inherit;
	font-weight: 700;
	font-size: 0.95rem;
	cursor: pointer;
	transition: background 0.15s ease;
}

.casa-btn:hover {
	background: var(--wp--preset--color--primary-dark);
}

/* ---------- Responsive ---------- */
@media (max-width: 781px) {
	.casa-intro-cols {
		flex-wrap: wrap;
	}

	.casa-intro-cols > .wp-block-column {
		flex-basis: 100% !important;
	}

	.casa-header-inner {
		justify-content: center;
	}
}
