/*
Theme Name: HSE Thuc Chien
Template: broadsheet
Description: Child theme for HSE Thuc Chien, building on the Broadsheet parent theme.
Version: 0.0.1
Requires at least: 7.0
Requires PHP: 8.3
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hsethucchien
*/

/* Faint engineering grid evokes drawing paper at the threshold of perception so content reads first. */
body {
	background-image:
		linear-gradient(to right, color-mix(in srgb, var(--wp--preset--color--contrast) 3.5%, transparent) 1px, transparent 1px),
		linear-gradient(to bottom, color-mix(in srgb, var(--wp--preset--color--contrast) 3.5%, transparent) 1px, transparent 1px);
	background-size: 30px 30px;
}

/* Links in dark chrome stay white and illuminate to hi-vis on hover. */
.hst-chrome a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--base);
}

.hst-chrome a:where(:not(.wp-element-button)):hover {
	color: var(--wp--preset--color--hivis);
}

/* Headings in dark chrome are white: the global heading colour is steel ink, invisible on chrome. */
.hst-chrome :is(h1, h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--base);
}

/* Section kicker rule switches to hi-vis on dark chrome. */
.hst-chrome .is-style-broadsheet-kicker::before {
	background: var(--wp--preset--color--hivis);
}

/* Header height includes the 6px hazard chevron so anchor offsets clear the sticky bar. */
:root {
	--broadsheet-header-h: calc(44px + 2 * var(--wp--preset--spacing--30) + 1px + 6px);
}

/* Hazard-tape chevron motif along the top edge of the dark chrome header. */
.broadsheet-header.hst-chrome {
	background-image: repeating-linear-gradient(135deg, var(--wp--preset--color--contrast) 0 14px, var(--wp--preset--color--hivis) 14px 28px);
	background-position: top;
	background-repeat: no-repeat;
	background-size: 100% 6px;
	padding-top: calc(var(--wp--preset--spacing--30) + 6px) !important;
}

/* Selection uses hi-vis background with contrast steel text for 10.80:1 contrast. */
::selection {
	background: var(--wp--preset--color--hivis);
	color: var(--wp--preset--color--contrast);
}

/* Form control boundaries outside chrome need 3:1 contrast against light paper and base surfaces. */
input:not(.hst-chrome *),
textarea:not(.hst-chrome *) {
	border-color: var(--wp--preset--color--muted);
}

/* White panels on the concrete paper canvas (docs/03 section 3). */
.is-style-broadsheet-card {
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	padding: var(--wp--preset--spacing--50);
}

/* ---------------------------------------------------------------------------------------------
 * Front page: value proposition, five pillars, learning paths, and featured post lead card.
 * ------------------------------------------------------------------------------------------- */

.hst-home-intro {
	border-left: 4px solid var(--wp--preset--color--primary);
}

.hst-home-intro h1 {
	margin: 0;
}

.hst-home-intro p {
	margin: 0;
}

.hst-pillars-grid,
.hst-paths-grid,
.hst-related__grid {
	display: grid;
	gap: var(--wp--preset--spacing--40);
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.hst-pillar-card,
.hst-path-card {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--40);
}

.hst-pillar-card > *,
.hst-path-card > * {
	margin: 0;
}

.hst-pillar-card__num {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
}

.hst-pillar-card__title,
.hst-path-card__title {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.25;
}

.hst-pillar-card__title a,
.hst-path-card__title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.hst-pillar-card__title a:hover,
.hst-path-card__title a:hover {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
}

.hst-pillar-card__desc,
.hst-path-card__desc {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

.hst-pillar-card__action {
	font-family: var(--wp--preset--font-family--ui);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--20);
}

.hst-path-card__meta {
	align-items: center;
	display: flex;
	gap: var(--wp--preset--spacing--20);
	justify-content: space-between;
}

.hst-path-card__step,
.hst-path-nav__badge {
	background: var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--radius--control);
	color: var(--wp--preset--color--on-accent);
	display: inline-block;
	font-family: var(--wp--preset--font-family--ui);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	padding: 0.125rem var(--wp--preset--spacing--20);
}

.hst-path-card__count {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
}

/* Featured post on page 1: the cover image already carries the article title, so the text column
 * shows category, standfirst excerpt, and date without repeating the title. */
body:not(.paged) .broadsheet-lead-grid > .wp-block-post-template > li:first-child:has(.wp-block-post-featured-image:not(.broadsheet-noimage)) .wp-block-post-title {
	display: none;
}

body:not(.paged) .broadsheet-lead-grid > .wp-block-post-template > li:first-child .wp-block-post-excerpt {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--medium);
}

@media (min-width: 782px) {
	body:not(.paged) .broadsheet-lead-grid > .wp-block-post-template > li:first-child > .broadsheet-teaser {
		grid-template-rows: 1fr auto auto auto 1fr;
		row-gap: var(--wp--preset--spacing--20);
	}

	body:not(.paged) .broadsheet-lead-grid > .wp-block-post-template > li:first-child .wp-block-post-terms {
		grid-row: 2;
	}

	body:not(.paged) .broadsheet-lead-grid > .wp-block-post-template > li:first-child .wp-block-post-excerpt {
		grid-row: 3;
	}

	body:not(.paged) .broadsheet-lead-grid > .wp-block-post-template > li:first-child .wp-block-post-date {
		grid-row: 4;
	}
}

/* ---------------------------------------------------------------------------------------------
 * Single article: compact top section for 390px phones, deferred cover, TOC, wide tables,
 * learning-path navigation, author box, and related posts.
 * ------------------------------------------------------------------------------------------- */

@media (max-width: 599px) {
	.single-post main.wp-block-group {
		padding-top: var(--wp--preset--spacing--30) !important;
	}

	.single-post .wp-block-post-title {
		font-size: var(--wp--preset--font-size--x-large);
		margin-block: var(--wp--preset--spacing--20);
	}

	.single-post .broadsheet-standfirst {
		font-size: var(--wp--preset--font-size--small) !important;
		margin-block: var(--wp--preset--spacing--20);
	}
}

/* The cover sits below the lead paragraph, so it no longer competes for the first screen. It is
   shown whole: the branded covers carry the title as text, which any crop would cut. */
.hst-article-cover {
	border-radius: var(--wp--custom--radius--control);
	margin-block: var(--wp--preset--spacing--40);
	overflow: hidden;
}

.hst-article-cover img {
	aspect-ratio: auto;
	display: block;
	height: auto;
	object-fit: contain;
	width: 100%;
}

/* Server-side Table of Contents. */
.hst-toc {
	margin-block: var(--wp--preset--spacing--50);
	padding: var(--wp--preset--spacing--40);
}

.hst-toc__title {
	font-family: var(--wp--preset--font-family--ui);
	font-weight: 700;
	margin: 0 0 var(--wp--preset--spacing--30);
}

.hst-toc__list {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding-left: var(--wp--preset--spacing--50);
}

.hst-toc__link {
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
}

.hst-toc__link:hover {
	color: var(--wp--preset--color--contrast);
	text-decoration: underline;
}

/* Wide tables: horizontal scroll on phones, wide alignment on desktop. */
.wp-block-post-content .wp-block-table {
	max-width: var(--wp--style--global--wide-size, 1240px);
	overflow-x: auto;
}

.hst-table-scroll {
	-webkit-overflow-scrolling: touch;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--control);
	overflow-x: auto;
	width: 100%;
}

.wp-block-table table,
.wp-block-table table.has-fixed-layout {
	border-collapse: collapse;
	margin: 0;
	min-width: 42rem;
	table-layout: auto;
	width: 100%;
}

.wp-block-table :is(th, td) {
	border: 1px solid var(--wp--preset--color--border);
	min-width: 7rem;
	padding: var(--wp--preset--spacing--30);
	text-align: left;
	vertical-align: top;
}

.wp-block-table thead th {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--ui);
	font-weight: 700;
}

/* "Trong lộ trình" previous/next learning-path navigation. */
.hst-path-nav {
	margin-top: var(--wp--preset--spacing--60);
	padding: var(--wp--preset--spacing--40);
}

.hst-path-nav__header {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
	justify-content: space-between;
}

.hst-path-nav__kicker {
	font-family: var(--wp--preset--font-family--ui);
	font-weight: 700;
	margin: 0;
}

.hst-path-nav__links {
	border-top: 1px solid var(--wp--preset--color--border);
	display: grid;
	gap: var(--wp--preset--spacing--40);
	margin-top: var(--wp--preset--spacing--40);
	padding-top: var(--wp--preset--spacing--40);
}

@media (min-width: 600px) {
	.hst-path-nav__links {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.hst-path-nav__item--next {
		grid-column: 2;
		text-align: right;
	}
}

.hst-path-nav__item {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
}

.hst-path-nav__dir {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--ui);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
}

.hst-path-nav__link {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	line-height: 1.25;
	text-decoration: none;
}

/* Author box. */
.hst-author-box {
	align-items: flex-start;
	display: flex;
	gap: var(--wp--preset--spacing--40);
	margin-top: var(--wp--preset--spacing--50);
	padding: var(--wp--preset--spacing--40);
}

.hst-author-box__media {
	flex-shrink: 0;
}

.hst-author-box__avatar {
	border-radius: 50%;
	display: block;
	height: 64px;
	width: 64px;
}

.hst-author-box__body {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	min-width: 0;
}

.hst-author-box__body > * {
	margin: 0;
}

.hst-author-box__role {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--ui);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
}

.hst-author-box__name {
	font-size: var(--wp--preset--font-size--large);
}

.hst-author-box__name a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.hst-author-box__name a:hover {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
}

.hst-author-box__bio {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

.hst-author-box__more {
	font-family: var(--wp--preset--font-family--ui);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
}

/* Related articles. */
.hst-related {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--40);
	margin-top: var(--wp--preset--spacing--60);
}

.hst-related > h2 {
	margin: 0;
}

.hst-related__item {
	display: flex;
}

.hst-related__item > .broadsheet-teaser {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--40);
}

.hst-related__item > .broadsheet-teaser > * {
	margin: 0;
}

.hst-related__excerpt {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

/* Archive empty states. */
.hst-empty-state--legal {
	border-left: 4px solid var(--wp--preset--color--alert);
}

/* Footer navigation lists. */
.hst-footer__list {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	list-style: none;
	margin: 0;
	padding-left: 0;
}

.hst-footer__list a {
	text-decoration: none;
}

.hst-footer__list a:hover {
	text-decoration: underline;
}

.hst-footer__legal p {
	margin: 0;
}

/* Five pillars and five learning paths: one row of five on wide screens instead of 4 + 1. */
@media (min-width: 72rem) {
	.hst-pillars-grid,
	.hst-paths-grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

/* Defence in depth: hide internal reviewer notes and render any unstripped proposal mark as plain
 * text on the public site, without affecting the /duyet/ reading page (body.hst-review). */
body:not(.hst-review) .hst-reviewer-notes {
	display: none;
}

body:not(.hst-review) mark.hst-proposal {
	background: none;
	color: inherit;
	padding: 0;
	text-decoration: none;
}
