/* =========================================================
   Post listing blocks. Loaded only on pages that use one,
   because WordPress enqueues a block's style on demand.
   Colours come from the theme's variables, with fallbacks so
   the blocks still look deliberate on somebody else's theme.
   ========================================================= */

.tc-posts { margin-block: var(--tc-space-lg, 2.5rem); }

.tc-posts__heading {
	font-size: var(--tc-fs-h3, 1.3rem);
	margin: 0 0 var(--tc-space-md, 1.25rem);
}

.tc-posts__list { display: grid; gap: var(--tc-space-md, 1.5rem); }

/* One column on a phone regardless of the setting: two 140px cards side by
   side is not a layout, it is two thumbnails nobody can read. */
@media (min-width: 640px) {
	.tc-posts--cols-2 .tc-posts__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tc-posts--cols-3 .tc-posts__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tc-posts--cols-4 .tc-posts__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
	.tc-posts--cols-3 .tc-posts__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.tc-posts--cols-4 .tc-posts__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tc-posts__item { position: relative; min-width: 0; }

.tc-posts__media {
	display: block;
	border-radius: var(--tc-radius, 10px);
	overflow: hidden;
	background: var(--tc-bg-alt, #f4f4f4);
	margin-bottom: .7rem;
}

/* The ratio is declared here too, so the row has its height before any
   picture arrives and the page does not shuffle while they load. */
.tc-posts__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }

.tc-posts__title {
	font-size: 1rem;
	line-height: 1.5;
	margin: 0 0 .35rem;
	font-weight: 600;
}
.tc-posts__title a { color: var(--tc-text, #1c1b1a); text-decoration: none; }
.tc-posts__title a:hover { color: var(--tc-accent, #e0503c); }

.tc-posts__excerpt {
	font-size: .88rem;
	line-height: 1.65;
	color: var(--tc-text-muted, #5a5754);
	margin: 0 0 .35rem;
}

.tc-posts__meta {
	display: flex; flex-wrap: wrap; gap: .35rem;
	font-size: .76rem;
	color: var(--tc-text-muted, #5a5754);
}

/* ---- single column: image beside the text, which is what a sidebar wants ---- */

.tc-posts--cols-1 .tc-posts__item {
	display: grid;
	grid-template-columns: 92px minmax(0, 1fr);
	gap: .8rem;
	align-items: start;
}
.tc-posts--cols-1 .tc-posts__media { margin-bottom: 0; }
.tc-posts--cols-1 .tc-posts__img { aspect-ratio: 1 / 1; }
.tc-posts--cols-1 .tc-posts__title { font-size: .95rem; }
.tc-posts--cols-1 .tc-posts__excerpt { display: none; }
.tc-posts--cols-1.tc-posts--noimg .tc-posts__item { grid-template-columns: minmax(0, 1fr); }

/* ---- ranking ---- */

.tc-posts--popular .tc-posts__rank {
	display: inline-block;
	font-size: .78rem;
	font-weight: 700;
	line-height: 1;
	color: var(--tc-accent, #e0503c);
	margin-bottom: .3rem;
}
.tc-posts--cols-1.tc-posts--popular .tc-posts__item { grid-template-columns: 1.4rem 92px minmax(0, 1fr); }
.tc-posts--cols-1.tc-posts--popular.tc-posts--noimg .tc-posts__item { grid-template-columns: 1.4rem minmax(0, 1fr); }
.tc-posts--cols-1.tc-posts--popular .tc-posts__rank {
	font-size: 1.15rem;
	opacity: .55;
	margin: 0;
	padding-top: .1rem;
}

.tc-posts__empty {
	padding: 1rem;
	border: 1px dashed var(--tc-border, #e7e3df);
	border-radius: var(--tc-radius, 10px);
	color: var(--tc-text-muted, #5a5754);
	font-size: .9rem;
	text-align: center;
}

/* =========================================================
   Article section — heading, description, button, then the
   row of cards the widgets above already know how to draw.
   ========================================================= */

.tc-section { margin-block: var(--tc-space-lg, 2.5rem); }

/*
 * The words and the button sit on one line where there is room and stack where
 * there is not. flex-wrap does that on its own; a media query would have to
 * guess a breakpoint without knowing how long the heading is.
 */
.tc-section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--tc-space-md, 1.5rem);
	margin-bottom: var(--tc-space-lg, 2.5rem);
}

.tc-section__words { min-width: 0; flex: 1 1 min(100%, 34ch); }

.tc-section__title {
	margin: 0;
	font-size: var(--tc-fs-h2, clamp(1.4rem, 1.15rem + 1vw, 1.9rem));
	line-height: var(--tc-lh-heading, 1.25);
	color: var(--tc-text, #1c1b1a);
}

.tc-section__desc {
	margin: .6rem 0 0;
	max-width: 62ch;
	font-size: .95rem;
	line-height: 1.75;
	color: var(--tc-text-muted, #5a5754);
}

.tc-section__cta {
	flex: 0 0 auto;
	display: inline-block;
	padding: .8rem 1.9rem;
	border: 1px solid var(--tc-border, #e7e3df);
	border-radius: 999px;
	background: var(--tc-bg-alt, #faf7f4);
	color: var(--tc-text, #1c1b1a);
	font-size: .95rem;
	text-decoration: none;
	transition: background .15s, border-color .15s, color .15s;
}
.tc-section__cta:hover {
	background: var(--tc-accent, #e0503c);
	border-color: var(--tc-accent, #e0503c);
	color: #fff;
}

/* The section has its own spacing above the row, so the list must not add a
   second lot of it. */
.tc-section .tc-posts { margin-block: 0; }

/* ---------- Category label on a card ---------- */

.tc-posts__cat {
	display: inline-block;
	margin-bottom: .35rem;
	font-size: .78rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--tc-accent, #e0503c);
	text-decoration: none;
}
.tc-posts__cat:hover { text-decoration: underline; }

/* =========================================================
   Contact channels. Every value comes from the site's own
   settings, so this only has to worry about how they look.
   ========================================================= */

.tc-contact { margin-block: var(--tc-space-lg, 2.5rem); }

.tc-contact__head { margin-bottom: var(--tc-space-lg, 2.5rem); }

.tc-contact__title {
	margin: 0;
	font-size: var(--tc-fs-h2, clamp(1.4rem, 1.15rem + 1vw, 1.9rem));
	line-height: var(--tc-lh-heading, 1.25);
	color: var(--tc-text, #1c1b1a);
}

.tc-contact__desc {
	margin: .7rem 0 0;
	max-width: 62ch;
	font-size: .95rem;
	line-height: 1.75;
	color: var(--tc-text-muted, #5a5754);
}

/* Centring the heading should centre the line under it too, and a max-width
   with an auto margin is the only way a centred paragraph stays centred. */
.tc-contact__head[style*="center"] .tc-contact__desc { margin-inline: auto; }

.tc-contact__list {
	display: grid;
	gap: var(--tc-space-md, 1.5rem);
	list-style: none;
	margin: 0;
	padding: 0;
}

.tc-contact__link {
	display: flex;
	align-items: center;
	gap: .9rem;
	text-decoration: none;
	color: var(--tc-text, #1c1b1a);
	transition: border-color .15s, background .15s, color .15s;
}

.tc-contact__icon {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: var(--tc-accent, #e0503c);
	background: var(--tc-bg-alt, #faf7f4);
}

.tc-contact__body { min-width: 0; }

.tc-contact__name { display: block; font-weight: 600; line-height: 1.4; }

/* The address wraps rather than runs off the side of its card: an overflowing
   link is invisible on a phone and pushes the whole page sideways. */
.tc-contact__value {
	display: block;
	margin-top: .15rem;
	font-size: .84rem;
	line-height: 1.5;
	color: var(--tc-text-muted, #5a5754);
	overflow-wrap: anywhere;
}

/* ---------- Cards ---------- */

.tc-contact--cards .tc-contact__link {
	padding: 1rem 1.15rem;
	border: 1px solid var(--tc-border, #e7e3df);
	border-radius: var(--tc-radius, 10px);
	background: var(--tc-surface, #fff);
	height: 100%;
}
.tc-contact--cards .tc-contact__link:hover {
	border-color: var(--tc-accent, #e0503c);
	color: var(--tc-accent, #e0503c);
}
.tc-contact--cards .tc-contact__link:hover .tc-contact__icon {
	background: var(--tc-accent, #e0503c);
	color: #fff;
}

/* ---------- Buttons in a row ---------- */

.tc-contact--buttons .tc-contact__list {
	display: flex;
	flex-wrap: wrap;
	gap: .7rem;
}

.tc-contact--buttons .tc-contact__link {
	gap: .55rem;
	padding: .7rem 1.3rem;
	border: 1px solid var(--tc-border, #e7e3df);
	border-radius: 999px;
	font-size: .95rem;
}
.tc-contact--buttons .tc-contact__link:hover {
	border-color: var(--tc-accent, #e0503c);
	color: var(--tc-accent, #e0503c);
}

.tc-contact--buttons .tc-contact__icon {
	width: 22px;
	height: 22px;
	background: none;
	border-radius: 0;
}
.tc-contact--buttons .tc-contact__icon svg { width: 18px; height: 18px; }
