/* ==========================================================================
   BRAT Diet Care - Blog
   ==========================================================================

   The blog index, the archives, the single post, the comment thread and the
   search results. Everything reads from the custom properties declared in
   site.css, so the whole section follows Appearance -> BRAT Diet Care ->
   Colours & layout, light and dark.

   Class map
     .brat-hero-*        blog index / archive intro
     .brat-grid          the post grid
     .brat-card          one post in the grid
     .brat-feature       the first, larger post
     .brat-post-*        single post
     .brat-share         share + copy-link row
     .brat-author        author box under the post
     .brat-related       "read next" strip
     .brat-comments      the comment thread
     .brat-pagination    older / newer links
     .brat-empty         no posts yet state
   --------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Index + archive intro
   -------------------------------------------------------------------------- */

.brat-hero {
	margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
	padding-bottom: clamp(1.5rem, 4vw, 2.25rem);
	border-bottom: 1px solid var(--brat-line);
	text-align: center;
}

.brat-hero__title {
	margin: 0.75rem 0 0;
	font-size: clamp(1.9rem, 5vw, 2.85rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.03em;
	color: var(--brat-ink);
	text-wrap: balance;
}

.brat-hero__lead {
	max-width: 58ch;
	margin: 0.9rem auto 0;
	font-size: 1.02rem;
	color: var(--brat-ink-soft);
}

.brat-hero__cta {
	margin-top: 1.35rem;
}

.brat-hero__meta {
	margin-top: 1rem;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--brat-ink-mute);
}

/* --------------------------------------------------------------------------
   Featured post
   -------------------------------------------------------------------------- */

.brat-feature {
	display: grid;
	grid-template-columns: 1fr;
	overflow: hidden;
	margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
	text-decoration: none;
	color: inherit;
	transition: transform var(--brat-speed) ease, border-color var(--brat-speed) ease;
}

.brat-feature:hover {
	transform: translateY(-2px);
	border-color: var(--brat-accent-line);
}

@media (min-width: 780px) {
	.brat-feature {
		grid-template-columns: 1.15fr 1fr;
		align-items: stretch;
	}
}

.brat-feature__media {
	position: relative;
	background: var(--brat-card-2);
	aspect-ratio: 16 / 10;
	overflow: hidden;
}

@media (min-width: 780px) {
	.brat-feature__media {
		aspect-ratio: auto;
		min-height: 320px;
	}
}

.brat-feature__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.brat-feature:hover .brat-feature__media img {
	transform: scale(1.03);
}

.brat-feature__body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.75rem;
	padding: clamp(1.35rem, 4vw, 2.25rem);
}

.brat-feature__title {
	margin: 0;
	font-size: clamp(1.35rem, 3vw, 1.85rem);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--brat-ink);
	text-wrap: balance;
}

.brat-feature:hover .brat-feature__title {
	color: var(--brat-accent-text);
}

.brat-feature__excerpt {
	margin: 0;
	color: var(--brat-ink-soft);
}

.brat-feature__more {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--brat-accent-text);
}

.brat-feature__more::after {
	content: "→";
	transition: transform var(--brat-speed) ease;
}

.brat-feature:hover .brat-feature__more::after {
	transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Post grid
   -------------------------------------------------------------------------- */

.brat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
	gap: clamp(1rem, 2.5vw, 1.5rem);
}

.brat-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: transform var(--brat-speed) ease, border-color var(--brat-speed) ease;
}

.brat-card:hover {
	transform: translateY(-3px);
	border-color: var(--brat-accent-line);
}

.brat-card__media {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--brat-card-2);
}

.brat-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.brat-card:hover .brat-card__media img {
	transform: scale(1.04);
}

/* No featured image: a calm branded panel with the first letter, so the grid
   never collapses into ragged holes. */
.brat-card__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: linear-gradient(140deg, var(--brat-accent-tint), var(--brat-card-2));
	color: var(--brat-accent-text);
	font-size: 2.4rem;
	font-weight: 800;
	letter-spacing: -0.03em;
}

.brat-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	flex: 1 1 auto;
	padding: 1.15rem 1.25rem 1.35rem;
}

.brat-card__title {
	margin: 0;
	font-size: 1.08rem;
	font-weight: 800;
	line-height: 1.32;
	letter-spacing: -0.015em;
	color: var(--brat-ink);
	text-wrap: balance;
}

.brat-card:hover .brat-card__title {
	color: var(--brat-accent-text);
}

.brat-card__excerpt {
	margin: 0;
	font-size: 0.88rem;
	color: var(--brat-ink-soft);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.brat-card__more {
	margin-top: auto;
	padding-top: 0.35rem;
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--brat-accent-text);
}

/* --------------------------------------------------------------------------
   Shared meta row (date, author, reading time)
   -------------------------------------------------------------------------- */

.brat-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 0.75rem;
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--brat-ink-mute);
	line-height: 1.4;
}

.brat-meta > * {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

/* The author and the reading time read as one unit, so the separator between
   them carries no weight of its own. */
.brat-meta__author,
.brat-meta__reading,
.brat-meta__terms {
	white-space: nowrap;
}

.brat-meta__reading {
	font-variant-numeric: tabular-nums;
}

.brat-meta__sep {
	color: var(--brat-line);
}

.brat-meta a {
	color: inherit;
	text-decoration: none;
}

.brat-meta a:hover {
	color: var(--brat-accent-text);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.brat-meta__avatar {
	width: 18px;
	height: 18px;
	border-radius: 999px;
	object-fit: cover;
}

/* --------------------------------------------------------------------------
   Single post
   -------------------------------------------------------------------------- */

.brat-post {
	--brat-post-max: 820px;
}

.brat-post-hero {
	margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.brat-post-hero__title {
	margin: 0.85rem 0 0;
	font-size: clamp(1.9rem, 5.2vw, 3rem);
	font-weight: 800;
	line-height: 1.08;
	letter-spacing: -0.035em;
	color: var(--brat-ink);
	text-wrap: balance;
}

.brat-post-hero__title a {
	color: inherit;
	text-decoration: none;
}

.brat-post-hero__lead {
	max-width: 60ch;
	margin: 1rem 0 0;
	font-size: 1.06rem;
	color: var(--brat-ink-soft);
}

.brat-post-hero .brat-meta {
	margin-top: 1.1rem;
	padding-top: 1.1rem;
	border-top: 1px solid var(--brat-line);
}

.brat-post-hero__media {
	margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
	border-radius: var(--brat-r);
	overflow: hidden;
	background: var(--brat-card-2);
	box-shadow: var(--brat-elev);
}

.brat-post-hero__media img {
	display: block;
	width: 100%;
	height: auto;
}

.brat-post-hero__media figcaption {
	margin: 0;
	padding: 0.7rem 1rem;
	font-size: 0.78rem;
	color: var(--brat-ink-mute);
	text-align: center;
}

/* Full-bleed featured image: edge to edge, no radius, inside the same band. */
@media (min-width: 900px) {
	.brat-post--bleed .brat-post-hero__media {
		margin-inline: calc(50% - 50vw);
		border-radius: 0;
		max-width: 100vw;
		width: 100vw;
	}
}

.brat-post-hero__cta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-top: 1.5rem;
}

/* Medical / informational note pinned above the body copy. */
.brat-post-note {
	display: flex;
	gap: 0.75rem;
	margin: 0 0 2rem;
	padding: 1rem 1.15rem;
	border: 1px solid var(--brat-accent-line);
	border-radius: var(--brat-r-sm);
	background: var(--brat-accent-tint);
	font-size: 0.85rem;
	line-height: 1.6;
	color: var(--brat-ink-soft);
}

.brat-post-note__icon {
	flex: 0 0 auto;
	font-size: 1.1rem;
	line-height: 1.4;
}

.brat-post-note p {
	margin: 0;
}

.brat-post-note strong {
	color: var(--brat-ink);
}

/* --------------------------------------------------------------------------
   Share row
   -------------------------------------------------------------------------- */

.brat-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: clamp(2rem, 5vw, 3rem) 0 0;
	padding-top: 1.5rem;
	border-top: 1px solid var(--brat-line);
}

.brat-share__label {
	margin: 0 0.35rem 0 0;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--brat-ink-mute);
}

.brat-share__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	min-width: 2.4rem;
	height: 2.4rem;
	padding: 0 0.75rem;
	border: 1px solid var(--brat-line);
	border-radius: var(--brat-r-pill);
	background: var(--brat-card);
	color: var(--brat-ink-soft);
	font-size: 0.78rem;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: border-color var(--brat-speed) ease, color var(--brat-speed) ease, background var(--brat-speed) ease;
}

.brat-share__btn:hover {
	border-color: var(--brat-accent);
	background: var(--brat-accent-tint);
	color: var(--brat-accent-text);
}

.brat-share__btn--copy[data-copied="true"] {
	border-color: var(--brat-accent);
	background: var(--brat-accent);
	color: var(--brat-accent-ink);
}

/* The icon carries the meaning, the label is the detail: on a narrow screen
   only the icon is left, which is why it needs a size of its own. */
.brat-share__btn-text {
	font-size: 0.78rem;
}

@media (max-width: 460px) {
	.brat-share__btn-text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

/* --------------------------------------------------------------------------
   Author box
   -------------------------------------------------------------------------- */

.brat-author {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
	margin: clamp(2rem, 5vw, 3rem) 0 0;
	padding: 1.25rem;
	background: var(--brat-card);
	border: 1px solid var(--brat-line);
	border-radius: var(--brat-r);
}

.brat-author__avatar {
	width: 56px;
	height: 56px;
	border-radius: 999px;
	object-fit: cover;
	flex: 0 0 auto;
	background: var(--brat-card-2);
}

.brat-author__name {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 800;
	color: var(--brat-ink);
}

.brat-author__role {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--brat-accent-text);
}

.brat-author__bio {
	margin: 0.35rem 0 0;
	font-size: 0.85rem;
	color: var(--brat-ink-soft);
}

.brat-author__body {
	flex: 1 1 260px;
	min-width: 0;
}

/* --------------------------------------------------------------------------
   Previous / next
   -------------------------------------------------------------------------- */

.brat-post-nav {
	display: grid;
	gap: 0.75rem;
	margin-top: clamp(1.5rem, 4vw, 2.5rem);
}

@media (min-width: 700px) {
	.brat-post-nav {
		grid-template-columns: 1fr 1fr;
	}
}

.brat-post-nav__link {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: 1rem 1.15rem;
	background: var(--brat-card);
	border: 1px solid var(--brat-line);
	border-radius: var(--brat-r-sm);
	text-decoration: none;
	transition: border-color var(--brat-speed) ease, transform var(--brat-speed) ease;
}

.brat-post-nav__link:hover {
	border-color: var(--brat-accent);
	transform: translateY(-2px);
}

.brat-post-nav__link--next {
	text-align: right;
	align-items: flex-end;
}

/* "Previous" reads left-to-right and "next" reads on, so the arrow sits on the
   outer edge of each card rather than both on the same side. */
.brat-post-nav__link--prev::before {
	content: "←";
}

.brat-post-nav__link--next::after {
	content: "→";
}

.brat-post-nav__link--prev .brat-post-nav__label,
.brat-post-nav__link--next .brat-post-nav__label {
	order: 2;
}

.brat-post-nav__label {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--brat-ink-mute);
}

.brat-post-nav__title {
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--brat-ink);
}

.brat-post-nav__link--empty {
	visibility: hidden;
}

/* --------------------------------------------------------------------------
   Read next
   -------------------------------------------------------------------------- */

.brat-related {
	margin-top: clamp(2.5rem, 6vw, 4rem);
	padding-top: clamp(1.5rem, 4vw, 2rem);
	border-top: 1px solid var(--brat-line);
}

.brat-related__title {
	margin: 0 0 1.1rem;
	font-size: 1.15rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--brat-ink);
}

.brat-related .brat-card__excerpt {
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

/* --------------------------------------------------------------------------
   Comments
   -------------------------------------------------------------------------- */

.brat-comments {
	margin-top: clamp(2.5rem, 6vw, 4rem);
	padding-top: clamp(1.5rem, 4vw, 2rem);
	border-top: 1px solid var(--brat-line);
}

.brat-comments__title {
	margin: 0 0 1.25rem;
	font-size: 1.15rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--brat-ink);
}

.comment-list {
	margin: 0 0 2rem;
	padding: 0;
	list-style: none;
}

.comment-list .children {
	margin: 1rem 0 0 1.25rem;
	padding: 0;
	list-style: none;
	border-left: 1px solid var(--brat-line);
	padding-left: 1.25rem;
}

.comment-body {
	padding: 1rem 0;
	border-bottom: 1px solid var(--brat-line);
}

.comment-author {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	font-size: 0.85rem;
}

.comment-author img.avatar {
	width: 34px;
	height: 34px;
	border-radius: 999px;
	object-fit: cover;
}

.comment-author .says {
	color: var(--brat-ink-mute);
	font-size: 0.78rem;
}

.comment-metadata {
	margin: 0.2rem 0 0 2.6rem;
	font-size: 0.74rem;
	color: var(--brat-ink-mute);
}

.comment-metadata a {
	color: inherit;
}

.comment-content {
	margin: 0.6rem 0 0;
	font-size: 0.92rem;
	color: var(--brat-ink-soft);
}

.comment-content p {
	margin-bottom: 0.7em;
}

.reply {
	font-size: 0.78rem;
	font-weight: 700;
}

.reply a,
.bypostauthor {
	color: var(--brat-accent-text);
}

.bypostauthor > .comment-author .fn::after {
	content: " · author";
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--brat-accent-text);
}

.comment-awaiting-moderation {
	display: inline-block;
	margin-top: 0.5rem;
	padding: 0.3rem 0.7rem;
	border-radius: var(--brat-r-pill);
	background: var(--brat-warn-tint);
	color: var(--brat-warn);
	font-size: 0.75rem;
	font-weight: 700;
}

.comment-respond {
	padding: clamp(1.25rem, 3vw, 1.75rem);
	background: var(--brat-card);
	border: 1px solid var(--brat-line);
	border-radius: var(--brat-r);
}

.comment-reply-title {
	margin: 0 0 0.35rem;
	font-size: 1.05rem;
	font-weight: 800;
	color: var(--brat-ink);
}

.comment-form {
	margin-top: 1rem;
}

.comment-form p {
	margin-bottom: 0.9rem;
	font-size: 0.88rem;
}

.comment-form label {
	display: block;
	margin-bottom: 0.3rem;
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--brat-ink-soft);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	padding: 0.65rem 0.85rem;
	border: 1px solid var(--brat-line);
	border-radius: var(--brat-r-sm);
	background: var(--brat-page);
	color: var(--brat-ink);
	font: inherit;
	font-size: 0.9rem;
}

.comment-form textarea {
	min-height: 140px;
	resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
	outline: none;
	border-color: var(--brat-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--brat-accent) 18%, transparent);
}

.comment-form .comment-form-cookies-consent {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.comment-form .comment-form-cookies-consent label {
	margin: 0;
	font-weight: 500;
	color: var(--brat-ink-mute);
}

.comment-form .form-submit {
	margin: 0;
}

.comment-form .submit,
.comment-form .comment-reply-title + .comment-form .submit {
	padding: 0.7rem 1.5rem;
	border: 0;
	border-radius: var(--brat-r-pill);
	background: var(--brat-accent);
	color: var(--brat-accent-ink);
	font: inherit;
	font-size: 0.88rem;
	font-weight: 700;
	cursor: pointer;
	transition: background var(--brat-speed) ease;
}

.comment-form .submit:hover {
	background: var(--brat-accent-dark);
}

.no-comments {
	margin: 0 0 1.5rem;
	font-size: 0.88rem;
	color: var(--brat-ink-mute);
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.brat-pagination {
	display: flex;
justify-content: center;
	margin-top: clamp(2rem, 5vw, 3rem);
}

.brat-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
}

.brat-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.4rem;
	height: 2.4rem;
	padding: 0 0.7rem;
	border: 1px solid var(--brat-line);
	border-radius: var(--brat-r-sm);
	background: var(--brat-card);
	color: var(--brat-ink-soft);
	font-size: 0.82rem;
	font-weight: 700;
	text-decoration: none;
	transition: border-color var(--brat-speed) ease, color var(--brat-speed) ease;
}

.brat-pagination .page-numbers:hover {
	border-color: var(--brat-accent);
	color: var(--brat-accent-text);
}

.brat-pagination .page-numbers.current {
	background: var(--brat-accent);
	border-color: var(--brat-accent);
	color: var(--brat-accent-ink);
}

.brat-pagination .page-numbers.dots {
	border-color: transparent;
	background: none;
}

/* --------------------------------------------------------------------------
   Search box
   -------------------------------------------------------------------------- */

.brat-search {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin: 1.5rem auto 0;
	max-width: 32rem;
}

.brat-search__field {
	flex: 1 1 14rem;
	min-width: 0;
	padding: 0.65rem 1rem;
	border: 1px solid var(--brat-line);
	border-radius: var(--brat-r-pill);
	background: var(--brat-card);
	color: var(--brat-ink);
	font: inherit;
	font-size: 0.88rem;
}

.brat-search__field:focus {
	outline: none;
	border-color: var(--brat-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--brat-accent) 18%, transparent);
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */

.brat-empty {
	text-align: center;
	padding: clamp(2rem, 6vw, 3.5rem) clamp(1rem, 4vw, 2rem);
	background: var(--brat-card);
	border: 1px dashed var(--brat-line);
	border-radius: var(--brat-r);
}

.brat-empty__icon {
	font-size: 2.25rem;
	line-height: 1;
}

.brat-empty__title {
	margin: 0.75rem 0 0;
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--brat-ink);
}

.brat-empty__text {
	max-width: 46ch;
	margin: 0.5rem auto 0;
	color: var(--brat-ink-soft);
	font-size: 0.92rem;
}

.brat-empty .brat-btn-row {
	justify-content: center;
	margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.brat-card,
	.brat-card__media img,
	.brat-feature,
	.brat-feature__media img,
	.brat-post-nav__link,
	.brat-share__btn,
	.brat-site-nav__list a {
		transition: none;
	}

	.brat-card:hover,
	.brat-feature:hover,
	.brat-post-nav__link:hover {
		transform: none;
	}

	.brat-card:hover .brat-card__media img,
	.brat-feature:hover .brat-feature__media img {
		transform: none;
	}
}

@media (prefers-reduced-motion: no-preference) {
	html:not(.js) .brat-card,
	html:not(.js) .brat-feature {
		will-change: auto;
	}
}