/*
 * Compact layout (tablet and phone).
 *
 * This whole file is loaded with media="(max-width: …)" built from
 * Config::COMPACT_BREAKPOINT, so every rule here applies only below that
 * width. Phone sizes are in the @media block at the end (below 640px).
 *
 * Tablet (designed at 820px): 32px gutters, compact header, no sidebar,
 * larger featured card with excerpt, 140px thumbnails.
 */

:root {
	--gutter: 32px;
}

/* Header: avatar, name and tagline, theme toggle, menu button. Sticky. */
.site-header {
	background: var(--header-glow), var(--header-bg);
}
.site-header__inner {
	align-items: center;
	gap: 10px;
	padding-top: 16px;
	padding-bottom: 16px;
}
.site-brand { --tagline-size: 15px; flex: 1; gap: 12px; }
.site-brand__avatar { display: flex; }
.site-brand__avatar .avatar-mark { width: 48px; height: 48px; font-size: 17px; }
.site-title { font-size: 28px; letter-spacing: -.035em; }
.site-tagline { margin-top: 3px; }
.site-header__actions { gap: 8px; padding-bottom: 0; }

.primary-nav,
.header-search-button,
.updates { display: none; }
.menu-button { display: inline-flex; }

/* Mobile menu panel content. */
.mobile-menu__inner {
	display: flex;
	flex-direction: column;
	min-height: 100%;
	padding-top: 6px;
	padding-bottom: 20px;
}
.mobile-menu__search {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin: 14px 0 8px;
	padding: 13px 18px;
	border: 1px solid var(--control-border);
	border-radius: var(--radius-pill);
	background: transparent;
	color: var(--text-muted);
	font-size: 16px;
	text-align: left;
}
.mobile-menu__search .icon { width: 18px; height: 18px; }
.mobile-menu__search:active { border-color: var(--accent); color: var(--accent); }
.mobile-nav__list { list-style: none; }
.mobile-nav__list a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 0;
	border-bottom: 1px solid var(--hairline);
	font-size: 28px;
	font-weight: 700;
	letter-spacing: -.03em;
}
.mobile-nav__list a:active { opacity: .7; }
.mobile-nav__arrow { color: var(--accent); font-size: 22px; font-weight: 500; }
.mobile-nav__list .current-menu-item > a { color: var(--accent); }
.mobile-menu__label { margin: 32px 0 12px; color: var(--text-muted); }
.mobile-menu .pill-button { padding: 12px 24px; font-size: 15px; }
.mobile-menu .subscribe .button { padding: 13px; }
.mobile-menu__copyright { margin-top: auto; padding-top: 22px; color: var(--text-muted); font-size: 12px; }

/* One column, no sidebar. */
.layout,
.layout--article {
	display: block;
	min-height: 0;
	padding-top: 24px;
	padding-bottom: 64px;
}
.sidebar { display: none; }

/* Featured card: larger image, excerpt visible. */
.featured-card { grid-template-columns: 240px 1fr; gap: 22px; }

/* Latest / Popular tabs. */
.home-tabs {
	display: flex;
	gap: 6px;
	margin: 18px 0 2px;
	border-bottom: 1px solid var(--hairline);
}
.home-tabs__tab {
	margin-bottom: -1px;
	padding: 10px 14px;
	border: 0;
	border-bottom: 2px solid transparent;
	background: none;
	color: var(--text-muted);
	font-size: 15px;
	font-weight: 600;
}
.home-tabs__tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.home-tabs__tab:focus-visible { outline-offset: -2px; border-radius: 6px; }
.tab-panel--popular { display: block; }
.tab-panel--latest[hidden] { display: none !important; }

/* Feed rows: 140px thumbnails, three-line excerpt. */
.feed-row { grid-template-columns: 140px 1fr; gap: 22px; }
.feed-row--text { grid-template-columns: 1fr; }
.feed-row__title { font-size: 24px; }
.feed-row__excerpt {
	display: -webkit-box;
	overflow: hidden;
	font-size: 16px;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

/* Search: full-screen takeover with Cancel. */
.search-dialog {
	width: 100%;
	height: 100%;
	max-height: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: var(--bg);
}
.search-dialog[open] { animation: none; }
.search-dialog__head { gap: 12px; padding: 14px 16px; }
.search-dialog__field {
	gap: 10px;
	height: 46px;
	padding: 0 14px;
	border: 1.5px solid var(--accent);
	border-radius: var(--radius-pill);
	background: var(--surface);
}
.search-dialog__field .icon { width: 18px; height: 18px; }
.search-dialog__field input { font-size: 16px; }
.search-dialog__esc,
.search-dialog__hint { display: none; }
.search-dialog__clear:not([hidden]) {
	display: block;
	padding: 0 2px;
	border: 0;
	background: none;
	color: var(--text-muted);
	font-size: 22px;
	line-height: 1;
}
.search-dialog__cancel {
	display: block;
	padding: 6px 0;
	border: 0;
	background: none;
	color: var(--accent);
	font-size: 15px;
	font-weight: 600;
}
.search-dialog__body { flex: 1; padding: 6px 16px; }
.search-dialog__count { margin: 10px 0 4px; padding: 0; }
.search-result {
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: 14px;
	padding: 14px 0;
}
.search-result:not(:has(.search-result__thumb)) { grid-template-columns: 1fr; }
.search-result.is-active { background: none; }
.search-result__thumb {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: var(--thumb-radius);
	background: var(--placeholder);
}
.search-result__thumb img { width: 100%; height: 100%; object-fit: cover; }
.search-result__date { display: none; }
.search-result__title { margin-top: 2px; font-size: 17px; line-height: 1.25; }
.search-result__excerpt { line-height: 1.45; }
.search-dialog__note { padding: 18px 0; }
.search-dialog__foot { padding: 4px 16px 24px; }

/* Comments indent less. */
.comment-list .children { margin-left: 22px; }

/* Footer bar and normal footer padding. */
.site-footer__inner { padding-inline: var(--gutter); }
.site-footer:not(.site-footer--bar) .site-footer__inner { padding-block: 24px; }

/* Header icon buttons: 44px tap area around the 36-40px circle. */
.icon-button { position: relative; }
.icon-button::before { content: ""; position: absolute; inset: -4px; }

/* ------------------------------------------------------------------ */
/* Phone (designed at 390px).                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 639.98px) {
	:root { --gutter: 16px; }

	.site-header__inner { padding-top: 12px; padding-bottom: 12px; }
	.site-brand { --tagline-size: 13px; gap: 10px; }
	.site-brand__avatar .avatar-mark { width: 40px; height: 40px; font-size: 15px; }
	.site-title { font-size: 22px; }
	.icon-button { width: 36px; height: 36px; }
	.icon-button .icon { width: 18px; height: 18px; }

	.mobile-menu__inner { padding-inline: 20px; }

	.layout,
	.layout--article { padding-top: 14px; padding-bottom: 40px; }
	.layout--article { padding-top: 20px; }

	/* Slim featured card: 72px thumbnail and title. */
	.featured-card {
		grid-template-columns: 72px 1fr;
		gap: 12px;
		margin-bottom: 6px;
		padding: 12px;
	}
	.featured-card__image { aspect-ratio: 1; }
	.featured-card__label { font-size: 10.5px; }
	.featured-card__title { margin: 4px 0 0; font-size: 17px; line-height: 1.2; }
	.featured-card__excerpt,
	.featured-card .read-more { display: none; }
	.home-tabs { margin-top: 14px; }

	/* Rows: 76px thumbnail, two-line excerpt, no read link. */
	.feed-row { grid-template-columns: 76px 1fr; gap: 12px; padding: 16px 0; }
	.feed-row--text { grid-template-columns: 1fr; }
	.feed-row__date { font-size: 11px; }
	.feed-row__title { margin: 2px 0 4px; font-size: 18px; line-height: 1.2; }
	.feed-row__excerpt { margin: 0; font-size: 14px; line-height: 1.45; -webkit-line-clamp: 2; }
	.feed-row .read-more { display: none; }
	.feed-status { padding-top: 24px; }

	/* Post. */
	.back-link { margin-bottom: 18px; }
	.entry-title { font-size: 30px; }
	.entry-deck { margin-bottom: 22px; font-size: 17px; }
	.entry-hero { margin: 0 calc(var(--gutter) * -1) 26px; }
	.entry-hero img { border-width: 1px 0; border-radius: 0; }
	.entry-hero figcaption { padding-inline: var(--gutter); }
	.entry-content { font-size: 17px; line-height: 1.7; }
	.entry-content > * { margin-bottom: 20px; }
	.entry-content h2 { margin: 32px 0 12px; font-size: 24px; }
	.entry-content blockquote,
	.entry-content .wp-block-quote { margin: 28px 0; padding-left: 18px; font-size: 20px; }
	.entry-content .alignleft,
	.entry-content .alignright { float: none; max-width: 100%; margin: 24px 0; }
	.comments { margin-top: 40px; }
	.comment-reply-title { margin-top: 32px; }

	/* Archive, search, 404. */
	.page-header__title { font-size: 32px; }
	.page-header__description { font-size: 16px; }
	.search-pill { height: 48px; padding-left: 16px; }
	.search-pill input { font-size: 16px; }
	.search-pill .button { padding: 9px 18px; }
	.not-found { padding: 48px 0 64px; }
	.not-found__numeral { font-size: 112px; }

	/* Popups: full width with 12px margins. */
	.read-next {
		right: 12px;
		bottom: 12px;
		left: 12px;
		width: auto;
	}
	.cookie-notice {
		right: 12px;
		left: 12px;
		bottom: calc(var(--footer-bar-height) + 8px);
		width: auto;
	}
	body:not(.has-footer-bar) .cookie-notice { bottom: 12px; }
	.site-footer__inner { gap: 12px; }
}
