/* ===========================================================================
   Konnect Dots :: shared card styles

   Lives in its own file because three pages need it and only one of them is
   built from includes/template.php. /user/<name> gets its stylesheets from
   header.php, but /portfolio/<name> and /portfolio/<name>/showcase are
   standalone documents that render their own <head> and load one stylesheet
   each. Anything they share has to be linked by all three explicitly.
   =========================================================================== */

/* ---- initials, when a profile photo is missing or fails to load ----

   Deliberately reuses whatever avatar class the page already has, so it
   inherits that page's size, shape and every responsive override without
   this file needing to know any of them. */

/* The fallback is rendered alongside the photo carrying the `hidden` attribute,
   and kdAvatarFallback() removes that attribute if the image fails to load.
   This rule is what makes `hidden` mean anything here: the browser's own
   [hidden] { display: none } comes from the user-agent stylesheet, and the
   author-level `display: flex` below beats it, so without this both the photo
   AND the initials showed on every profile that has a picture. */
.kd-initials[hidden] {
	display: none;
}

.kd-initials {
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #1e3a8a 0%, #3b5bb5 100%);
	color: #fff;
	font-weight: 700;
	letter-spacing: .04em;
	line-height: 1;
	user-select: none;
	/* the box is sized in px by the avatar class it sits on, and a percentage
	   font-size would resolve against the parent font, not the box -- so the
	   three sizes are set against their own classes below */
	font-size: 34px;
	overflow: hidden;
}

.kd-profile-hero__photo.kd-initials { font-size: 76px; }   /* 220px avatar */
.pf-hero__avatar.kd-initials        { font-size: 52px; }   /* 148px */
.sc-hero__avatar.kd-initials        { font-size: 34px; }   /* 96px  */

@media (max-width: 900px) {
	.pf-hero__avatar.kd-initials { font-size: 42px; }
}

@media (max-width: 780px) {
	.pf-hero__avatar.kd-initials { font-size: 36px; }
	.sc-hero__avatar.kd-initials { font-size: 28px; }
}

/* ---- "On Request" where a rate would go ---- */

.kd-profile-sidebar__price-amount--request,
.pf-price__amount--request,
.sc-hero__price-amount--request {
	/* a phrase, not a number: the big numeric sizing these carry makes two
	   words look shouted */
	font-size: .62em;
	letter-spacing: .01em;
	white-space: nowrap;
}

/* ===========================================================================
   Brochures & documents  (user_business_photos.file_type = 3)

   Each tile is one link. The cover of the PDF is painted onto a canvas by
   public/js/profile_pdf.js -- a still image of page one, not an embedded
   document -- and the file's name sits over the foot of that image.

   The first version embedded the PDF itself, which brought the browser's
   viewer with it: a scrollbar down the side, the whole document scrollable
   inside the tile, and nothing at all on phones, which decline to render PDFs
   inline. Painting a thumbnail avoids all three.
   =========================================================================== */

.kd-pdf-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 18px;
}

.kd-pdf-card {
	display: block;
	text-decoration: none;
	color: inherit;
	border-radius: 14px;
	/* the shadow is on the card, the crop is on the thumb, so the lift on hover
	   does not clip */
	box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 0 0 1px rgba(15, 23, 42, .05);
	transition: transform .18s ease, box-shadow .18s ease;
}

.kd-pdf-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 14px 28px rgba(15, 23, 42, .14), 0 0 0 1px rgba(30, 58, 138, .18);
}

.kd-pdf-card:focus-visible {
	outline: 2px solid #1e3a8a;
	outline-offset: 3px;
}

/* ---- the cover ---- */

.kd-pdf-card__thumb {
	position: relative;
	display: block;
	/* portrait, near enough A4 to look like a document without being so tall
	   that a row of them dominates the page */
	aspect-ratio: 3 / 4;
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
}

.kd-pdf-card__canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	/* CONTAIN, not cover. Cropping to fill the tile zoomed into the page and
	   cut the edges off, which is fine for a photo and wrong for a document --
	   a floor plan or a rate card loses the very thing it is showing. The whole
	   first page is fitted instead, with white either side where the page is a
	   different shape to the tile. */
	object-fit: contain;
	object-position: center;
	background: #fff;
	opacity: 0;
	transition: opacity .25s ease, transform .35s ease;
}

.kd-pdf-card__thumb.is-rendered .kd-pdf-card__canvas {
	opacity: 1;
}

/* no zoom on hover: it re-introduced the crop the contain fit removes */

/* shown until the canvas has something on it, and for good if it never does */
.kd-pdf-card__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #b6c2d2;
	transition: opacity .25s ease;
}

.kd-pdf-card__placeholder svg {
	width: 46px;
	height: 46px;
	stroke-width: 1.3;
}

.kd-pdf-card__thumb.is-rendered .kd-pdf-card__placeholder {
	opacity: 0;
}

/* ---- the PDF badge ---- */

.kd-pdf-card__badge {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	background: #dc2626;
	color: #fff;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: .08em;
	padding: 3px 7px;
	border-radius: 5px;
	box-shadow: 0 2px 6px rgba(15, 23, 42, .25);
}

/* ---- the name, over the foot of the cover ---- */

.kd-pdf-card__scrim {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 26px 12px 11px;
	/* a gradient rather than a solid bar, so the cover stays visible behind the
	   text instead of being cut off by a block of colour */
	background: linear-gradient(to top,
		rgba(8, 15, 30, .92) 0%,
		rgba(8, 15, 30, .72) 45%,
		rgba(8, 15, 30, 0) 100%);
	color: #fff;
}

.kd-pdf-card__name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.35;
	text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}

.kd-pdf-card__open {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-top: 5px;
	font-size: 11px;
	font-weight: 600;
	color: rgba(255, 255, 255, .82);
	transition: color .15s ease;
}

.kd-pdf-card:hover .kd-pdf-card__open {
	color: #fff;
}

.kd-pdf-card__open svg {
	width: 12px;
	height: 12px;
}

@media (max-width: 560px) {
	.kd-pdf-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 12px;
	}

	.kd-pdf-card__name {
		font-size: 12px;
	}

	/* a tap has no hover state to lift into, and the transform would only make
	   the tile feel loose under a thumb */
	.kd-pdf-card:hover {
		transform: none;
	}
}

/* "On Request" inside a package card, where the surrounding type is sized for
   a numeral. */
.kd-pricing-card__amount--request,
.pf-pack__amount--request,
.sc-pack__amount--request {
	font-size: .6em;
	letter-spacing: .01em;
	white-space: nowrap;
}

/* ===========================================================================
   Client reviews

   Shared by /user/<name> and both private portfolio pages, for the same reason
   the brochure cards are: only one of the three is built from the site template.
   =========================================================================== */

/* ---- the star row from kd_star_row() ---- */

.kd-stars {
	display: inline-flex;
	align-items: center;
	gap: 1px;
	color: #f59e0b;
	vertical-align: middle;
	line-height: 0;
}

.kd-stars__s {
	width: 15px;
	height: 15px;
	flex: 0 0 auto;
}

/* ---- overall score + distribution ---- */

.kd-rv-summary {
	display: flex;
	flex-wrap: wrap;
	gap: 28px;
	align-items: center;
	padding: 20px 22px;
	background: #f8fafc;
	border: 1px solid #eef2f7;
	border-radius: 14px;
	margin-bottom: 22px;
}

.kd-rv-summary__score {
	text-align: center;
	min-width: 128px;
}

.kd-rv-summary__number {
	font-size: 42px;
	font-weight: 800;
	line-height: 1;
	color: #0f172a;
	margin-bottom: 6px;
}

.kd-rv-summary__score .kd-stars__s {
	width: 19px;
	height: 19px;
}

.kd-rv-summary__total {
	margin-top: 6px;
	font-size: 12px;
	color: #64748b;
}

.kd-rv-summary__bars {
	flex: 1 1 220px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.kd-rv-bar {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 11px;
	color: #64748b;
}

.kd-rv-bar__label {
	width: 26px;
	flex: 0 0 auto;
	color: #94a3b8;
	white-space: nowrap;
}

.kd-rv-bar__track {
	flex: 1 1 auto;
	height: 6px;
	border-radius: 99px;
	background: #e6ebf2;
	overflow: hidden;
}

.kd-rv-bar__fill {
	display: block;
	height: 100%;
	background: #f59e0b;
	border-radius: 99px;
}

.kd-rv-bar__count {
	width: 18px;
	flex: 0 0 auto;
	text-align: right;
}

/* ---- per-question blocks ---- */

.kd-rv-block {
	margin-bottom: 22px;
}

.kd-rv-block__title {
	margin: 0 0 12px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: #94a3b8;
}

.kd-rv-scores {
	display: grid;
	gap: 9px;
}

.kd-rv-score {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 9px 13px;
	background: #fff;
	border: 1px solid #eef2f7;
	border-radius: 10px;
}

.kd-rv-score__q {
	font-size: 13px;
	color: #334155;
	line-height: 1.4;
}

.kd-rv-score__val {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	flex: 0 0 auto;
}

.kd-rv-score__val b {
	font-size: 13px;
	color: #0f172a;
}

.kd-rv-choice {
	margin-bottom: 13px;
}

.kd-rv-choice__q {
	font-size: 13px;
	color: #334155;
	margin-bottom: 6px;
	line-height: 1.4;
}

.kd-rv-choice__opts {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.kd-rv-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 600;
	color: #334155;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 999px;
	padding: 4px 5px 4px 11px;
}

.kd-rv-chip b {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 999px;
	background: #eff6ff;
	color: #1e3a8a;
	font-size: 11px;
}

/* ---- individual reviews ---- */

.kd-rv-list {
	display: grid;
	gap: 13px;
}

.kd-rv-card {
	padding: 17px 19px;
	background: #fff;
	border: 1px solid #eef2f7;
	border-radius: 13px;
}

.kd-rv-card__head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 11px;
}

.kd-rv-card__avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex: 0 0 auto;
	border-radius: 50%;
	background: linear-gradient(135deg, #1e3a8a 0%, #3b5bb5 100%);
	color: #fff;
	font-weight: 700;
	font-size: 16px;
}

.kd-rv-card__name {
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
}

.kd-rv-card__meta {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-top: 3px;
}

.kd-rv-card__date {
	font-size: 12px;
	color: #94a3b8;
}

.kd-rv-card__text {
	margin: 0;
	font-size: 14px;
	line-height: 1.65;
	color: #334155;
}

/* ---- the collapsed answer list ---- */

.kd-rv-answers {
	margin-top: 12px;
	border-top: 1px dashed #eef2f7;
	padding-top: 11px;
}

.kd-rv-answers summary {
	font-size: 12px;
	font-weight: 600;
	color: #1e3a8a;
	cursor: pointer;
	list-style: none;
}

.kd-rv-answers summary::-webkit-details-marker {
	display: none;
}

.kd-rv-answers summary::before {
	content: '\25B8';
	display: inline-block;
	margin-right: 6px;
	transition: transform .15s;
}

.kd-rv-answers[open] summary::before {
	transform: rotate(90deg);
}

.kd-rv-answers__list {
	margin: 12px 0 0;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 7px 16px;
	align-items: baseline;
}

.kd-rv-answers__list dt {
	font-size: 12.5px;
	color: #64748b;
	line-height: 1.45;
}

.kd-rv-answers__list dd {
	margin: 0;
	font-size: 12.5px;
	font-weight: 600;
	color: #0f172a;
	text-align: right;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 6px;
	justify-content: flex-end;
}

.kd-rv-answers__num {
	color: #64748b;
	font-weight: 600;
}

.kd-profile-hero__reviews-link {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px dotted currentColor;
}

@media (max-width: 620px) {
	.kd-rv-summary {
		gap: 18px;
		padding: 16px;
	}

	.kd-rv-score {
		flex-direction: column;
		align-items: flex-start;
		gap: 7px;
	}

	.kd-rv-answers__list {
		grid-template-columns: 1fr;
		gap: 2px 0;
	}

	.kd-rv-answers__list dd {
		text-align: left;
		justify-content: flex-start;
		margin-bottom: 8px;
	}
}
