/**
 * Blog index, archives and the article layout.
 *
 * Blog.dc.html and Article.dc.html. Card, chip and panel shapes are the same
 * tokens the shop uses - a reader moving from the journal to a product page
 * should not feel they changed sites.
 */

/* ---------------------------------------------------------------------------
 * Index head and topic chips
 * ------------------------------------------------------------------------ */

.sunny-blog__head {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding-top: var(--space-12);
}

.sunny-blog__title {
	margin: 0;
	max-width: 20ch;
}

.sunny-blog__intro {
	max-width: 65ch;
	color: var(--fg-secondary);
	font-size: var(--fs-body-lg);
	line-height: var(--lh-relaxed);
}

.sunny-topics {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	padding-top: var(--space-6);
}

/* The Tag component from the design system, same as .sunny-swatch. */
.sunny-topic {
	padding: 6px 14px;
	border: var(--border-w) solid var(--border-default);
	border-radius: var(--radius-pill);
	background: var(--surface-card);
	color: var(--fg-secondary);
	font-size: var(--fs-body-sm);
	font-weight: var(--fw-medium);
	transition: border-color var(--duration-fast) var(--ease-standard);
}

.sunny-topic:hover {
	border-color: var(--border-strong);
	color: var(--fg-secondary);
}

.sunny-topic.is-active {
	border-color: var(--surface-brand);
	background: var(--brand-50);
	color: var(--brand-700);
	font-weight: var(--fw-semibold);
}

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

.sunny-post-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	color: inherit;
	min-width: 0;
}

.sunny-post-card .sunny-media {
	overflow: hidden;
	border-radius: var(--radius-lg);
	background: var(--surface-sunken);
}

.sunny-post-card img {
	width: 100%;
	transition: transform var(--duration-slow) var(--ease-standard);
}

.sunny-post-card:hover img {
	transform: scale(1.03);
}

.sunny-post-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.sunny-post-card__kicker {
	font-family: var(--font-display);
	font-size: var(--fs-caption);
	font-weight: var(--fw-extrabold);
	letter-spacing: var(--ls-wide);
	text-transform: uppercase;
	color: var(--surface-accent);
}

.sunny-post-card__title {
	margin: 0;
	font-size: var(--fs-heading-sm);
	line-height: var(--lh-snug);
	color: var(--fg-primary);
}

.sunny-post-card:hover .sunny-post-card__title {
	color: var(--fg-link-hover);
}

.sunny-post-card__excerpt {
	color: var(--fg-secondary);
	line-height: var(--lh-relaxed);
}

.sunny-post-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	font-size: var(--fs-caption);
	color: var(--fg-muted);
}

/* --- The promoted post --- */

.sunny-blog__featured-wrap {
	padding-top: var(--space-8);
}

.sunny-featured-card {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
	gap: var(--space-8);
	align-items: center;
	padding: var(--space-5);
	border: var(--border-w) solid var(--border-default);
	border-radius: var(--radius-xl);
	background: var(--surface-card);
	color: inherit;
}

.sunny-featured-card > * {
	min-width: 0;
}

.sunny-featured-card__media {
	display: block;
	overflow: hidden;
	border-radius: var(--radius-lg);
	background: var(--surface-sunken);
	aspect-ratio: 16 / 10;
}

.sunny-featured-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sunny-featured-card__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-3);
}

.sunny-featured-card__title {
	margin: 0;
	font-size: var(--fs-display-md);
	line-height: var(--lh-tight);
}

.sunny-featured-card:hover .sunny-featured-card__title {
	color: var(--fg-link-hover);
}

.sunny-featured-card__excerpt {
	color: var(--fg-secondary);
	font-size: var(--fs-body-lg);
	line-height: var(--lh-relaxed);
}

/* ---------------------------------------------------------------------------
 * Newsletter band
 * ------------------------------------------------------------------------ */

.sunny-newsletter {
	margin-top: var(--rhythm-section-y);
	padding-block: var(--rhythm-section-y-tight);
	background: var(--surface-brand);
	color: var(--fg-on-brand);
}

.sunny-newsletter__inner {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
	gap: var(--space-8);
	align-items: center;
}

.sunny-newsletter__inner > * {
	min-width: 0;
}

.sunny-newsletter__title {
	margin: 0 0 var(--space-2);
	color: inherit;
	font-size: var(--fs-display-md);
}

.sunny-newsletter__text {
	margin: 0;
	color: inherit;
	opacity: 0.9;
	line-height: var(--lh-relaxed);
}

/* The band sits on a dark panel, so the field loses its border and the focus
   ring goes light - the shared rules in base.css cover everything else. */
.sunny-newsletter__form {
	max-width: none;
}

.sunny-newsletter .sunny-newsletter__input {
	flex: 1 1 220px;
	border: 0;
}

.sunny-newsletter .sunny-newsletter__input:focus {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.sunny-newsletter .sunny-btn--accent {
	padding: 0 var(--space-6);
	height: 50px;
	border: 0;
	border-radius: var(--radius-pill);
	background: var(--surface-accent);
	color: var(--fg-on-accent);
	font-family: var(--font-display);
	font-weight: var(--fw-extrabold);
	font-size: var(--fs-body-md);
	cursor: pointer;
}

.sunny-newsletter .sunny-btn--accent:hover {
	background: var(--surface-accent-hover);
}

/* ---------------------------------------------------------------------------
 * Article
 * ------------------------------------------------------------------------ */

.sunny-article__head {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	padding-top: var(--space-8);
	max-width: 900px;
}

.sunny-article__title {
	margin: 0;
	font-size: var(--fs-display-lg);
}

.sunny-article__byline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--fs-body-sm);
	color: var(--fg-secondary);
}

.sunny-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: var(--radius-pill);
	background: var(--brand-100);
	color: var(--brand-800);
	font-family: var(--font-display);
	font-size: var(--fs-caption);
	font-weight: var(--fw-extrabold);
}

.sunny-article__hero {
	overflow: hidden;
	margin-top: var(--space-8);
	border-radius: var(--radius-xl);
	background: var(--surface-sunken);
	aspect-ratio: 21 / 9;
}

.sunny-article__hero img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Three columns: the contents rail, the body, the sidebar. Below the wide
   breakpoint they stack, and the rail moves above the body it describes. */
.sunny-article__layout {
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr) 320px;
	gap: var(--space-10);
	align-items: start;
	margin-top: var(--rhythm-section-y-tight);
}

.sunny-article__layout--no-toc {
	grid-template-columns: minmax(0, 1fr) 320px;
}

.sunny-article__layout > * {
	min-width: 0;
}

@media (max-width: 1100px) {
	.sunny-article__layout,
	.sunny-article__layout--no-toc {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--space-8);
	}
}

.sunny-article__body {
	max-width: 70ch;
	font-size: var(--fs-body-lg);
	line-height: var(--lh-relaxed);
}

.sunny-article__body blockquote {
	margin: var(--space-6) 0;
	padding: var(--space-4) var(--space-6);
	border-left: 3px solid var(--surface-brand);
	background: var(--brand-50);
	color: var(--fg-primary);
	font-family: var(--font-display);
	font-size: var(--fs-heading-sm);
	line-height: var(--lh-snug);
}

/* --- Contents rail --- */

.sunny-toc {
	position: sticky;
	top: calc(var(--header-h) + var(--space-4));
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.sunny-toc__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--fs-body-sm);
	font-weight: var(--fw-extrabold);
	letter-spacing: var(--ls-wide);
	text-transform: uppercase;
	color: var(--fg-muted);
}

.sunny-toc__list {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: sunny-toc;
}

.sunny-toc__link {
	display: block;
	padding: var(--space-2) var(--space-3);
	border-left: 2px solid var(--border-default);
	color: var(--fg-secondary);
	font-size: var(--fs-body-sm);
	line-height: var(--lh-snug);
	transition:
		border-color var(--duration-fast) var(--ease-standard),
		color var(--duration-fast) var(--ease-standard);
}

.sunny-toc__link:hover,
.sunny-toc__link.is-active {
	border-color: var(--surface-brand);
	color: var(--brand-700);
	font-weight: var(--fw-semibold);
}

/* Anchor links land under the sticky header without this. */
.sunny-article__body h2 {
	scroll-margin-top: calc(var(--sticky-offset) + var(--space-2));
}

/* --- Sidebar --- */

.sunny-article__aside {
	position: sticky;
	top: calc(var(--header-h) + var(--space-4));
	display: flex;
	flex-direction: column;
	gap: var(--space-6);
}

@media (max-width: 1100px) {
	.sunny-toc,
	.sunny-article__aside {
		position: static;
	}
}

.sunny-article__panel {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	padding: var(--space-5);
	border: var(--border-w) solid var(--border-default);
	border-radius: var(--radius-lg);
	background: var(--surface-card);
}

.sunny-article__panel-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--fs-body-sm);
	font-weight: var(--fw-extrabold);
	letter-spacing: var(--ls-wide);
	text-transform: uppercase;
	color: var(--fg-muted);
}

.sunny-article__related {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}

/* In the sidebar the cards are a list, not a gallery - drop the image to a
   thumbnail so three of them fit without pushing the body off screen. */
.sunny-article__related .sunny-post-card {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	gap: var(--space-3);
	align-items: start;
}

.sunny-article__related .sunny-media {
	border-radius: var(--radius-md);
	aspect-ratio: 1;
}

.sunny-article__related img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sunny-article__related .sunny-post-card__title {
	font-size: var(--fs-body-md);
}

.sunny-article__related .sunny-post-card__meta {
	font-size: 11px;
}

.sunny-article__products {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.sunny-article__product {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr);
	gap: var(--space-3);
	align-items: center;
	color: inherit;
}

.sunny-article__product .sunny-media {
	overflow: hidden;
	border-radius: var(--radius-md);
	background: var(--surface-sunken);
	aspect-ratio: 1;
}

.sunny-article__product img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sunny-article__product-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.sunny-article__product-title {
	font-family: var(--font-display);
	font-weight: var(--fw-bold);
	font-size: var(--fs-body-sm);
	line-height: var(--lh-snug);
	color: var(--fg-primary);
}

.sunny-article__product-price {
	font-size: var(--fs-body-sm);
	color: var(--fg-secondary);
}
