/*
 * Organizations — archive and single.
 *
 * The fourth distinct treatment in the directory, and distinct for a reason.
 * A Heart Place is found by where it is and opens on a photograph; an event is
 * found by when it happens and opens on a date. An organization is judged by
 * what it is and who vouches for it, so this page opens on a masthead — the
 * mark, the name, what kind of body it is, and the badges an administrator has
 * confirmed — with no photographic hero at all.
 *
 * That also solves a practical problem: the image on an organization listing is
 * usually a logo, and a logo cropped to fill a hero is ruined. Here it is
 * contained in a tile instead.
 *
 * Colour, type and spacing come from gcn-tokens.css.
 */

/* ==========================================================================
   Masthead

   A full-bleed photograph under a gradient, the same treatment the Heart Place
   pages use, so the two read as one directory. What keeps Organizations
   distinct is what sits on it: the mark in its own tile, the type and reach
   line, the confirmed badges, and the two actions — a credential block rather
   than a caption.
   ========================================================================== */

.gcn-org__masthead {
	position: relative;
	display: flex;
	/* A Bricks section is a column flex, so the vertical axis is the main one. */
	flex-direction: column;
	justify-content: flex-end;
	min-height: 440px;
	padding-block: var(--gcn-space-12) var(--gcn-space-10) !important;
	background-color: #10161c;
	background-image: var(--gcn-hero-image, none);
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	isolation: isolate;
}

/*
 * The gradient runs the full width: solid at the left where the text sits,
 * opening across the picture, with a second wash up from the foot so the
 * bottom edge carries weight.
 */
.gcn-org__masthead::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(
			90deg,
			rgba(9, 13, 17, 0.94) 0%,
			rgba(9, 13, 17, 0.86) 32%,
			rgba(9, 13, 17, 0.58) 62%,
			rgba(9, 13, 17, 0.28) 100%
		),
		linear-gradient(180deg, rgba(9, 13, 17, 0.35) 0%, rgba(9, 13, 17, 0) 40%, rgba(9, 13, 17, 0.45) 100%);
}

/* On a narrow screen the text spans the full width, so the gradient has to run
   top to bottom or the right-hand words fall off the dark end. */
@media (max-width: 767px) {

	.gcn-org__masthead {
		min-height: 380px;
	}

	.gcn-org__masthead::before {
		background: linear-gradient(
			180deg,
			rgba(9, 13, 17, 0.45) 0%,
			rgba(9, 13, 17, 0.86) 58%,
			rgba(9, 13, 17, 0.95) 100%
		);
	}
}

.gcn-org__identity {
	display: flex;
	flex-direction: column;
	gap: 0;
	max-width: 640px;
}

/* Bricks wraps each shortcode in a block-level div; dropped from the layout so
   the tile and the badge row size to their contents. */
.gcn-org__identity > .brxe-shortcode {
	display: contents;
}

.gcn-org__crumbs {
	margin-bottom: var(--gcn-space-5);
	font-size: var(--gcn-text-sm);
	color: rgba(255, 255, 255, 0.62);
}

.gcn-org__crumbs a,
.gcn-org__crumbs .item {
	color: rgba(255, 255, 255, 0.62);
	text-decoration: none;
}

.gcn-org__crumbs a:hover {
	color: var(--gcn-text-inverse);
}

/* --------------------------------------------------------------------------
   The mark

   Kept as a tile on the photograph: a logo needs its own ground to read
   against, and it is the one thing here that must not be cropped.
   -------------------------------------------------------------------------- */

.gcn-org__logo {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 88px;
	height: 88px;
	margin-bottom: var(--gcn-space-5);
	padding: var(--gcn-space-3);
	background: var(--gcn-surface);
	border: 1px solid rgba(255, 255, 255, 0.24);
	border-radius: var(--gcn-radius-md);
	box-shadow: 0 8px 26px rgba(9, 13, 17, 0.36);
}

.gcn-org__logo img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.gcn-org__logo--empty {
	font-size: 32px;
	font-weight: var(--gcn-weight-bold);
	color: var(--gcn-brand-strong);
	background: var(--gcn-brand-soft);
	border-color: rgba(255, 255, 255, 0.3);
}

/* --------------------------------------------------------------------------
   Name and standfirst
   -------------------------------------------------------------------------- */

.gcn-org__name {
	margin: 0;
	font-size: var(--gcn-text-3xl);
	font-weight: var(--gcn-weight-semibold);
	line-height: var(--gcn-leading-tight);
	letter-spacing: var(--gcn-tracking-tight);
	color: var(--gcn-text-inverse);
	text-wrap: balance;
}

/* Type and reach read as one statement: "Ministry · National". */
.gcn-org__standfirst {
	margin-top: var(--gcn-space-3);
	font-size: var(--gcn-text-md);
	color: rgba(255, 255, 255, 0.82);
}

.gcn-org__badges {
	margin-top: var(--gcn-space-5);
}

/* --------------------------------------------------------------------------
   Actions
   -------------------------------------------------------------------------- */

.gcn-org__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gcn-space-3);
	margin-top: var(--gcn-space-6);
}

.gcn-org__actions > .brxe-shortcode {
	display: contents;
}

.gcn-org__action {
	display: inline-flex;
	align-items: center;
	gap: var(--gcn-space-2);
	padding: 11px var(--gcn-space-6);
	font-size: var(--gcn-text-base);
	font-weight: var(--gcn-weight-semibold);
	border-radius: var(--gcn-radius-pill);
	text-decoration: none;
	transition:
		background-color var(--gcn-duration) var(--gcn-ease),
		border-color var(--gcn-duration) var(--gcn-ease),
		color var(--gcn-duration) var(--gcn-ease);
}

.gcn-org__action--primary {
	color: var(--gcn-brand-contrast);
	background: var(--gcn-brand);
	border: 1px solid var(--gcn-brand);
}

.gcn-org__action--primary:hover {
	background: var(--gcn-brand-strong);
	border-color: var(--gcn-brand-strong);
	color: var(--gcn-brand-contrast);
}

/* Outlined in white, since it now sits on a photograph rather than on paper. */
.gcn-org__action--secondary {
	color: var(--gcn-text-inverse);
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.32);
	backdrop-filter: blur(6px);
}

.gcn-org__action--secondary:hover {
	background: rgba(255, 255, 255, 0.2);
	border-color: rgba(255, 255, 255, 0.5);
	color: var(--gcn-text-inverse);
}

/* --------------------------------------------------------------------------
   Badges

   These carry weight: they say an administrator has confirmed a relationship,
   so they are drawn as credentials rather than as the soft chips used
   elsewhere. A tick precedes each one.
   -------------------------------------------------------------------------- */

.gcn-chip--verified,
.gcn-chip--function {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 6px 14px;
	font-size: var(--gcn-text-sm);
	font-weight: var(--gcn-weight-semibold);
	border-radius: var(--gcn-radius-pill);
}

.gcn-chip--verified::before,
.gcn-chip--function::before {
	content: "";
	width: 13px;
	height: 13px;
	background-color: currentColor;
	-webkit-mask-image: var(--gcn-icon-tick);
	mask-image: var(--gcn-icon-tick);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.gcn-chip--verified {
	color: var(--gcn-brand-strong);
	background: var(--gcn-brand-soft);
	border: 1px solid var(--gcn-brand-border);
}

.gcn-chip--function {
	color: var(--gcn-text-soft);
	background: var(--gcn-surface);
	border: 1px solid var(--gcn-rule-strong);
}

/* On the masthead they sit on a photograph, so a pale fill would disappear
   against a light patch of it. Frosted instead. */
.gcn-org__masthead .gcn-chip--verified {
	color: #8ff0cd;
	background: rgba(30, 113, 74, 0.34);
	border-color: rgba(143, 240, 205, 0.42);
}

.gcn-org__masthead .gcn-chip--function {
	color: var(--gcn-text-inverse);
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.3);
	backdrop-filter: blur(6px);
}

/* ==========================================================================
   Body — a stack of sections, as the workbook's Detail Layouts prescribe
   ========================================================================== */

.gcn-org__body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: var(--gcn-space-16);
	align-items: start;
}

.gcn-org__lead {
	font-size: var(--gcn-text-xl);
	line-height: var(--gcn-leading-normal);
	color: var(--gcn-text);
}

.gcn-org__prose {
	font-size: var(--gcn-text-lg);
	line-height: var(--gcn-leading-relaxed);
	color: var(--gcn-text-soft);
}

.gcn-org__prose p {
	margin: 0 0 1em;
}

.gcn-org__prose p:last-child {
	margin-bottom: 0;
}

.gcn-org__section {
	margin-top: var(--gcn-space-10);
	padding-top: var(--gcn-space-8);
	border-top: 1px solid var(--gcn-rule);
}

.gcn-org__section-title {
	margin: 0 0 var(--gcn-space-4);
	font-size: var(--gcn-text-xl);
	font-weight: var(--gcn-weight-semibold);
	color: var(--gcn-text);
}

/* --------------------------------------------------------------------------
   Hub profile

   Six fields of claim, so it is set apart on its own tinted panel rather than
   flowing with the description. It renders only for a Hub an administrator has
   verified; the template carries that condition.
   -------------------------------------------------------------------------- */

.gcn-org__hub {
	margin-top: var(--gcn-space-10);
	padding: var(--gcn-space-8);
	background: var(--gcn-brand-soft);
	border: 1px solid var(--gcn-brand-border);
	border-radius: var(--gcn-radius-lg);
}

.gcn-org__hub .gcn-org__section-title {
	color: var(--gcn-brand-strong);
}

.gcn-org__hub-name {
	margin-bottom: var(--gcn-space-3);
	font-size: var(--gcn-text-lg);
	font-weight: var(--gcn-weight-semibold);
	color: var(--gcn-text);
}

.gcn-org__hub .gcn-detail__label {
	color: var(--gcn-brand-strong);
}

/* ==========================================================================
   Aside card
   ========================================================================== */

.gcn-org__card {
	position: sticky;
	top: 110px;
	padding: var(--gcn-space-6) var(--gcn-space-6) var(--gcn-space-8);
	background: var(--gcn-surface);
	border: 1px solid var(--gcn-rule);
	border-radius: var(--gcn-radius-lg);
	box-shadow: var(--gcn-shadow-md);
}

.gcn-org__card-title {
	margin: 0 0 var(--gcn-space-4);
	font-size: var(--gcn-text-xs);
	font-weight: var(--gcn-weight-bold);
	letter-spacing: var(--gcn-tracking-wide);
	text-transform: uppercase;
	color: var(--gcn-text-muted);
}

.gcn-org__card-group:not(:has(.gcn-detail)) {
	display: none;
}

.gcn-org__card-group:has(.gcn-detail) ~ .gcn-org__card-group:has(.gcn-detail) {
	margin-top: var(--gcn-space-6);
	padding-top: var(--gcn-space-6);
	border-top: 1px solid var(--gcn-rule);
}

/* ==========================================================================
   Archive

   The card carries a full-width cover photograph and needs no image rules of
   its own: GeoDirectory's own ratio box crops it correctly, exactly as it does
   on the Heart Places cards, so the archive reads as one directory. The
   contained-logo tile stays on the single page's masthead, where a mark has
   room to be shown at its own proportions.

   Only the text beneath the image is adjusted.
   ========================================================================== */

.geodir-page-cpt-gd_property .geodir-post .gcn-org__standfirst {
	margin-top: 0;
	font-size: var(--gcn-text-sm);
}

.geodir-page-cpt-gd_property .geodir-post .gcn-chip--verified,
.geodir-page-cpt-gd_property .geodir-post .gcn-chip--function {
	font-size: var(--gcn-text-2xs);
	padding: 4px 10px;
}

/* One row only, so every card's body starts at the same height. */
.geodir-page-cpt-gd_property .geodir-post .gcn-org__badges {
	flex-wrap: nowrap;
	overflow: hidden;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991px) {

	.gcn-org__body {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--gcn-space-10);
	}

	.gcn-org__card {
		position: static;
	}
}


/* The overflow count on a capped badge row. */
.gcn-chip--more {
	/* Matches the badges beside it so the row sits on one baseline. */
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	font-size: var(--gcn-text-2xs);
	font-weight: var(--gcn-weight-semibold);
	color: var(--gcn-text-muted);
	background: var(--gcn-surface-sunken);
	border: 1px solid var(--gcn-rule);
	border-radius: var(--gcn-radius-pill);
}

/* One row only on a card, so every card's body starts at the same height. */
.geodir-page-cpt-gd_property .geodir-post .gcn-org__badges {
	flex-wrap: nowrap;
	overflow: hidden;
}


.geodir-page-cpt-gd_property .geodir-post .gcn-org__logo--empty {
	width: 96px;
	font-size: 34px;
}

/* --------------------------------------------------------------------------
   A logo on a card

   The card fills its 16:9 frame, which suits a photograph and ruins a logo —
   a wordmark cropped to a letterbox loses the word. A logo is shown whole
   instead, on the card's own surface, with room to breathe.
   -------------------------------------------------------------------------- */

.geodir-post img.gcn-logo-image,
.geodir-image-container img.gcn-logo-image {
	object-fit: contain;
	background: var(--gcn-surface);
	/* GeoDirectory puts Bootstrap's p-0 utility on the image itself, and that
	   utility carries !important — so the breathing room has to answer in the
	   same terms. */
	padding: var(--gcn-space-5) !important;
}
