/*
Theme Name: Hot Gunners
Theme URI: https://hotgunners.com/
Author: Hot Gunners
Description: A block theme for the Hot Gunners Arsenal blog, in the colours of its crest: navy, white and cannon red. White pages with a navy header and footer, and one red shield-shaped band on the homepage.
Version: 1.1.0
Requires at least: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hotgunners
Tags: blog, news, block-patterns, full-site-editing, one-column, wide-blocks, featured-images, translation-ready
*/

:root {
	--hg-hair: 1px solid var(--wp--preset--color--line);
	--hg-rule: 3px solid var(--wp--preset--color--contrast);
	--hg-red-bar: 6px solid var(--wp--preset--color--accent);
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-deep);
	outline-offset: 3px;
}

::selection {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

img {
	max-width: 100%;
	height: auto;
}

/* ---------- Header: crest navy with a red bar underneath ---------- */

.hg-header {
	background: var(--wp--preset--color--crest);
	border-bottom: var(--hg-red-bar);
	color: var(--wp--preset--color--base);
	padding-block: 0.85rem;
}

.hg-header .wp-block-site-title a,
.hg-header .wp-block-navigation a {
	color: var(--wp--preset--color--base);
	text-decoration: none;
}

.hg-header .wp-block-site-title {
	letter-spacing: 0.01em;
}

.hg-header .wp-block-navigation a:hover,
.hg-header .wp-block-navigation a:focus-visible {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 3px;
	text-underline-offset: 0.45em;
}

.hg-header :focus-visible {
	outline-color: var(--wp--preset--color--base);
}

.hg-header .wp-block-navigation__responsive-container-open,
.hg-header .wp-block-navigation__responsive-container-close {
	color: var(--wp--preset--color--base);
}

.wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--crest);
	color: var(--wp--preset--color--base);
}

/* ---------- Page frame ---------- */

.hg-main {
	padding-block: clamp(2rem, 5vw, 4rem);
}

.wp-block-group.hg-front > * + * {
	margin-block-start: clamp(3rem, 6vw, 5rem);
}

.hg-intro {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	line-height: 1.3;
	max-width: 44ch;
}

.wp-block-group.hg-front > .hg-intro + * {
	margin-block-start: 1.5rem;
}

.hg-section-title {
	border-bottom: var(--hg-rule);
	padding-bottom: 0.5rem;
	margin-bottom: 1.75rem;
}

/* ---------- Shared post pieces ---------- */

.wp-block-post-title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.wp-block-post-title a:hover,
.wp-block-post-title a:focus-visible {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 0.09em;
	text-underline-offset: 0.14em;
}

.wp-block-post-featured-image img {
	display: block;
	width: 100%;
	object-fit: cover;
}

/* Category links are small red labels. */
.wp-block-post-terms a {
	display: inline-block;
	background: var(--wp--preset--color--accent-deep);
	color: var(--wp--preset--color--base);
	font-size: 0.78rem;
	font-weight: 700;
	line-height: 1;
	padding: 0.32em 0.55em;
	border-radius: 2px;
	text-decoration: none;
	margin: 0 0.3rem 0.3rem 0;
}

.wp-block-post-terms a:hover,
.wp-block-post-terms a:focus-visible {
	background: var(--wp--preset--color--crest);
}

/* Hide the default category label; it says nothing to readers. */
.wp-block-post-terms a[href*="/category/uncategorized"] {
	display: none;
}

.wp-block-post-terms .wp-block-post-terms__separator {
	display: none;
}

.wp-block-post-date,
.hg-meta {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-post-date a {
	color: inherit;
	text-decoration: none;
}

/* ---------- Homepage: lead story and more stories ---------- */

.hg-lead {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: clamp(1.5rem, 4vw, 3.5rem);
	align-items: start;
}

.wp-block-group.hg-lead > * {
	margin-block-start: 0;
}

.hg-lead .wp-block-post-template {
	list-style: none;
	margin: 0;
	padding: 0;
}

.hg-lead-story .wp-block-post-title {
	font-size: clamp(2.1rem, 1.1rem + 4vw, 4rem);
	line-height: 1;
	margin: 0.9rem 0 0.8rem;
	text-wrap: balance;
}

.hg-lead-story .wp-block-post-featured-image {
	margin-bottom: 1.1rem;
}

.hg-lead-story .wp-block-post-excerpt {
	max-width: 62ch;
	color: var(--wp--preset--color--muted);
}

.hg-lead-story .wp-block-post-excerpt__excerpt {
	margin: 0 0 0.6rem;
}

.hg-more {
	border-left: var(--hg-hair);
	padding-left: clamp(1.25rem, 2.5vw, 2rem);
}

.hg-more h2 {
	font-size: var(--wp--preset--font-size--large);
	margin: 0 0 1.25rem;
}

.hg-more .wp-block-post-template > li + li {
	border-top: var(--hg-hair);
	margin-block-start: 1.1rem;
	padding-top: 1.1rem;
}

.hg-more .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.15;
	margin: 0.35rem 0 0.4rem;
}

@media (max-width: 860px) {
	.hg-lead {
		grid-template-columns: minmax(0, 1fr);
	}

	.hg-more {
		border-left: 0;
		border-top: var(--hg-hair);
		padding-left: 0;
		padding-top: 1.5rem;
	}
}

/* ---------- Homepage: the red band, cut like the base of the crest ---------- */

.hg-band {
	--hg-point: clamp(18px, 3vw, 40px);
	background: var(--wp--preset--color--accent);
	border-top: 8px solid var(--wp--preset--color--crest);
	padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3rem) calc(clamp(1.5rem, 4vw, 3rem) + var(--hg-point));
	clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--hg-point)), 50% 100%, 0 calc(100% - var(--hg-point)));
}

.wp-block-group.hg-band > * {
	margin-block-start: 0;
}

.hg-band-title {
	color: var(--wp--preset--color--base);
	font-size: clamp(2rem, 1.2rem + 3vw, 3.25rem);
	line-height: 1;
	margin: 0 0 clamp(1.25rem, 3vw, 2rem);
	text-wrap: balance;
}

.hg-band .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
	gap: 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.hg-band .wp-block-post-template > li {
	position: relative;
	background: var(--wp--preset--color--base);
	border-bottom: 4px solid var(--wp--preset--color--crest);
	margin-block-start: 0;
	padding: 1.1rem 1.2rem 1.2rem;
}

.hg-band .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.15;
	margin: 0 0 0.5rem;
}

/* The whole white panel is the link target. */
.hg-band .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.hg-band .wp-block-post-template > li:hover .wp-block-post-title a,
.hg-band .wp-block-post-template > li:focus-within .wp-block-post-title a {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 0.09em;
	text-underline-offset: 0.14em;
}

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

.hg-grid .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 2.5rem 2rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.hg-grid .wp-block-post-template > li {
	border-top: var(--hg-hair);
	margin-block-start: 0;
	padding-top: 1rem;
}

.hg-grid .wp-block-post-featured-image {
	margin-bottom: 0.9rem;
}

.hg-grid .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.15;
	margin: 0.3rem 0 0.45rem;
}

.wp-block-query-pagination {
	border-top: var(--hg-hair);
	margin-top: 2.5rem;
	padding-top: 1.25rem;
	font-weight: 600;
}

.wp-block-query-pagination a {
	color: var(--wp--preset--color--contrast);
}

.wp-block-query-pagination .current {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	padding: 0.1em 0.45em;
}

/* ---------- Single post and pages ---------- */

.hg-article-head .wp-block-post-title {
	margin: 0.8rem 0 1rem;
	text-wrap: balance;
}

.hg-byline {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	gap: 0.4rem 1.1rem;
}

.hg-byline .wp-block-post-author-name {
	color: var(--wp--preset--color--contrast);
	font-weight: 600;
}

.wp-block-post-content a {
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.18em;
}

.wp-block-post-content h2 {
	margin-top: 2.5rem;
}

.wp-block-post-content table {
	border-collapse: collapse;
	width: 100%;
	font-size: var(--wp--preset--font-size--small);
	font-variant-numeric: tabular-nums;
}

.wp-block-post-content th,
.wp-block-post-content td {
	border: var(--hg-hair);
	padding: 0.55rem 0.7rem;
	text-align: left;
}

.wp-block-post-content th,
.wp-block-post-content thead td {
	background: var(--wp--preset--color--crest);
	color: var(--wp--preset--color--base);
	font-weight: 700;
}

.wp-block-post-content tbody tr:nth-child(even) td {
	background: var(--wp--preset--color--surface);
}

.wp-block-table {
	overflow-x: auto;
}

.hg-post-nav {
	border-top: var(--hg-hair);
	margin-top: 3rem;
	padding-top: 1.25rem;
	font-weight: 600;
}

.hg-post-nav a {
	color: var(--wp--preset--color--contrast);
}

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

.hg-comments {
	border-top: var(--hg-rule);
	margin-top: 3rem;
	padding-top: 1.5rem;
}

.hg-comments .wp-block-comment-template {
	list-style: none;
	padding: 0;
}

.hg-comments .wp-block-comment-template li {
	border-bottom: var(--hg-hair);
	padding-block: 1rem;
}

.hg-comments .wp-block-comment-date {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

/* ---------- Forms ---------- */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
textarea,
.wp-block-search__input {
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--muted);
	border-radius: 2px;
	color: var(--wp--preset--color--contrast);
	font: inherit;
	padding: 0.65rem 0.8rem;
}

textarea {
	width: 100%;
	box-sizing: border-box;
}

input::placeholder,
textarea::placeholder {
	color: var(--wp--preset--color--muted);
}

/* ---------- Footer: crest navy with a red bar on top ---------- */

.hg-footer {
	background: var(--wp--preset--color--crest);
	border-top: var(--hg-red-bar);
	color: var(--wp--preset--color--base);
	margin-top: clamp(2rem, 5vw, 4rem);
	padding-block: 2.25rem 3rem;
}

.hg-footer .wp-block-site-title a,
.hg-footer a {
	color: var(--wp--preset--color--base);
}

.hg-footer .wp-block-site-title a {
	text-decoration: none;
}

.hg-footer :focus-visible {
	outline-color: var(--wp--preset--color--base);
}

.hg-tagline {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 800;
	margin: 0.4rem 0 0;
}

.hg-footer-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.5rem;
	list-style: none;
	padding: 0;
}

.hg-footer-links ul {
	display: none;
}

.hg-small {
	color: #c9c6e6;
	font-size: var(--wp--preset--font-size--small);
}

/* ---------- Motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
		scroll-behavior: auto !important;
	}
}

@media print {
	.hg-header {
		background: none;
		border: 0;
	}

	.hg-header .wp-block-site-title a {
		color: #000;
	}

	.hg-header .wp-block-navigation,
	.hg-footer,
	.hg-band,
	.hg-post-nav,
	.hg-comments {
		display: none;
	}
}
