/*
Theme Name: Copper PDF
Theme URI: https://copper-pdf.com/
Author: Zamasoft
Description: The site as a printed sheet on a pasteboard: a white page with double crop marks at its corners, and the kappa. Classic theme, no build step.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: copperpdf
*/

/* ---------- Tokens ---------- */

:root {
	/* The logo's colours: its black, its green, the darker green of the kappa's shell, and the green it was drawn on */
	--ink: #231f20;
	--green: #80c046;
	--deep: #2c7a3c;    /* green that text can take on the sheet */
	--pale: #acd4af;
	--board: #e6f0e4;   /* the pasteboard: the pale green, thinned */
	--sheet: #ffffff;
	--quiet: #5a5f57;   /* secondary text on the sheet */
	--hair: #ccd3c9;    /* rules */
	--wash: #f4f7f2;    /* code and table heads */

	--mincho: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "BIZ UDPMincho", "Noto Serif JP", "MS PMincho", serif;
	--gothic: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic Medium", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
	--latin: "Avenir Next", "Century Gothic", "URW Gothic", Futura, "Jost", "Segoe UI", var(--gothic);
	--mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

	--gutter: clamp(20px, 5vw, 64px);   /* inside the sheet */
	--measure: 44rem;                   /* the text column */
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--board);
	color: var(--ink);
	font-family: var(--gothic);
	font-size: 1rem;
	line-height: 1.9;
	font-feature-settings: "palt";
	overflow-wrap: anywhere;
}

img,
svg,
video,
iframe {
	max-width: 100%;
}

img {
	height: auto;
}

a {
	color: inherit;
	text-decoration-color: var(--green);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.3em;
}

a:hover {
	color: var(--deep);
}

:focus-visible {
	outline: 2px solid var(--deep);
	outline-offset: 3px;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 10;
	padding: 0.5rem 1rem;
	background: var(--ink);
	color: #fff;
}

.skip-link:focus {
	left: 0;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------- The sheet and its marks ---------- */

.sheet {
	position: relative;
	max-width: 1180px;
	margin: 0;
	background: var(--sheet);
}

/* From here up the sheet lies on the board, and the corners get their marks */
@media (min-width: 960px) {
	.sheet {
		margin: 60px auto 72px;
		width: calc(100% - 128px);
	}

	/* Japanese double corner marks: the inner lines continue the trim edges, the outer ones the bleed (3 : 7) */
	.mark {
		position: absolute;
		width: 31px;
		height: 31px;
		background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 31 31' fill='none' stroke='%23231f20'%3E%3Cpath d='M0 21.5H21.5V0M0 30.5H21.5M30.5 0V21.5'/%3E%3C/svg%3E") no-repeat;
		pointer-events: none;
	}

	.mark-tl {
		top: -30px;
		left: -30px;
	}

	.mark-tr {
		top: -30px;
		right: -30px;
		transform: scaleX(-1);
	}

	.mark-bl {
		bottom: -30px;
		left: -30px;
		transform: scaleY(-1);
	}

	.mark-br {
		bottom: -30px;
		right: -30px;
		transform: scale(-1);
	}
}

/* ---------- The mascot ---------- */

.kappa {
	display: block;
	height: auto;
}

.kappa-lost {
	width: 92px;
	margin-bottom: 1.2rem;
}

/* ---------- Header ---------- */

/* The logo, the search box beside it, the menu under them; on a wide screen the menu moves under the search box */
.site-header {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas:
		"brand search"
		"nav nav";
	align-items: center;
	gap: 14px 24px;
	padding: 24px var(--gutter) 18px;
	border-bottom: 1px solid var(--ink);
}

.site-header .brand,
.site-header .custom-logo-link {
	grid-area: brand;
}

.site-header .search-form {
	grid-area: search;
	justify-self: end;
	width: min(100%, 220px);
	gap: 0;
}

.site-header .search-field {
	padding: 0.35em 0.7em;
	font-size: 0.9rem;
}

/* Enter sends the search; the button stays for assistive technology */
.site-header .search-submit {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip-path: inset(50%);
}

.site-nav {
	grid-area: nav;
}

@media (min-width: 860px) {
	.site-header {
		grid-template-areas:
			"brand search"
			"brand nav";
		align-items: end;
		row-gap: 12px;
	}

	.site-nav {
		justify-self: end;
	}
}

.brand,
.custom-logo-link {
	display: block;
	line-height: 0;
}

.brand img,
.custom-logo-link img {
	display: block;
	width: auto;
	height: 64px;
}

.site-nav ul,
.footer-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 26px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav a {
	display: block;
	padding: 6px 0 4px;
	border-bottom: 3px solid transparent;
	font-family: var(--latin);
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-decoration: none;
}

.site-nav a:hover {
	color: var(--ink);
	border-bottom-color: var(--ink);
}

.site-nav .current-menu-item > a,
.site-nav .current_page_item > a,
.site-nav .current-page-ancestor > a,
.site-nav .current_page_ancestor > a {
	border-bottom-color: var(--green);
}

/* ---------- The opening of the front page ---------- */

.opening {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 28px;
	padding: clamp(32px, 5vw, 64px) var(--gutter);
	border-bottom: 1px solid var(--ink);
}

/* The site's own tagline, when it has one */
.tagline {
	margin: 0 0 1.4em;
	font-family: var(--mincho);
	font-size: clamp(1.45rem, 2.5vw, 2.05rem);
	font-weight: 600;
	line-height: 1.6;
	word-break: auto-phrase;
	text-wrap: balance;
}

/* On a narrow screen the drawing comes first */
.opening-art {
	order: -1;
	width: min(64%, 250px);
}

.opening-art svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.art-page {
	fill: var(--sheet);
	stroke: var(--ink);
	stroke-width: 0.5;
}

.art-marks {
	fill: none;
	stroke: var(--ink);
	stroke-width: 0.45;
}

.art-head {
	fill: var(--ink);
}

.art-lines {
	fill: none;
	stroke: var(--hair);
	stroke-width: 1.5;
}

.art-figure {
	fill: var(--pale);
}

.art-folio {
	fill: none;
	stroke: var(--quiet);
	stroke-width: 1.2;
}

@media (min-width: 860px) {
	.opening {
		grid-template-columns: minmax(0, 1fr) minmax(260px, 0.5fr);
		align-items: center;
		gap: 56px;
	}

	.opening-art {
		order: 0;
		justify-self: end;
		width: min(100%, 400px);
	}
}

/* ---------- Buttons ---------- */

.button,
.entry-content .wp-block-button__link,
input[type="submit"],
button[type="submit"] {
	display: inline-block;
	padding: 0.72em 1.6em;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: var(--ink);
	color: #fff;
	font: 600 1rem/1.5 var(--gothic);
	text-decoration: none;
	cursor: pointer;
}

.button:hover,
.entry-content .wp-block-button__link:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
	background: var(--green);
	color: var(--ink);
}

/* ---------- Text column and sidebar ---------- */

.columns {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 56px;
	padding: clamp(36px, 6vw, 72px) var(--gutter);
}

@media (min-width: 1000px) {
	.columns {
		grid-template-columns: minmax(0, 1fr) 248px;
		gap: 72px;
	}
}

.content {
	min-width: 0;
}

.content > article,
.content > .page-header,
.content > .toc,
.content > p,
.content > .comments,
.content > .post-nav,
.content > .pagination,
.content > form {
	max-width: var(--measure);
}

.page-header {
	margin-bottom: 2.4rem;
}

.page-header h1,
.front-page .entry-title,
.home.page .entry-title {
	margin: 0;
	font-family: var(--mincho);
	font-size: clamp(1.6rem, 3vw, 2.15rem);
	font-weight: 600;
	line-height: 1.45;
	word-break: auto-phrase;
	text-wrap: balance;
}

.home.page .entry-title {
	margin-bottom: 1.6rem;
}

.entry-meta {
	margin: 0.6rem 0 0;
	color: var(--quiet);
	font-family: var(--latin);
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

/* ---------- The text of pages and posts (also what the previous theme's pages carry) ---------- */

.entry-content > :first-child {
	margin-top: 0;
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
	margin: 2.6em 0 0.8em;
	line-height: 1.5;
	word-break: auto-phrase;
	text-wrap: balance;
}

.entry-content h1,
.entry-content h2 {
	padding-bottom: 0.35em;
	border-bottom: 1px solid var(--ink);
	font-family: var(--mincho);
	font-size: 1.55rem;
	font-weight: 600;
}

.entry-content h3 {
	font-size: 1.2rem;
}

.entry-content h4 {
	font-size: 1.05rem;
}

.entry-content p,
.entry-content ul,
.entry-content ol,
.entry-content dl,
.entry-content table,
.entry-content pre,
.entry-content blockquote,
.entry-content figure {
	margin: 0 0 1.5em;
}

.entry-content li + li {
	margin-top: 0.35em;
}

.entry-content dt {
	font-weight: 700;
}

.entry-content dd {
	margin: 0 0 1em 1.5em;
}

.entry-content blockquote {
	padding: 0.2em 0 0.2em 1.4em;
	border-left: 2px solid var(--ink);
	color: var(--quiet);
}

.entry-content hr {
	margin: 3em 0;
	border: 0;
	border-top: 1px dotted var(--ink);
}

.entry-content table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 0.94rem;
	line-height: 1.7;
}

.entry-content th,
.entry-content td {
	padding: 0.55em 0.9em;
	border: 1px solid var(--hair);
	vertical-align: top;
	text-align: left;
}

.entry-content th {
	background: var(--wash);
	font-weight: 700;
}

.entry-content code,
.entry-content kbd,
.entry-content samp {
	font-family: var(--mono);
	font-size: 0.92em;
}

.entry-content :not(pre) > code {
	padding: 0.1em 0.35em;
	background: var(--wash);
}

.entry-content pre {
	max-width: 100%;
	overflow-x: auto;
	padding: 1em 1.2em;
	border-left: 2px solid var(--ink);
	background: var(--wash);
	font: 0.9rem/1.7 var(--mono);
	overflow-wrap: normal;
	tab-size: 4;
}

.entry-content .alignleft {
	float: left;
	margin: 0.3em 1.6em 1em 0;
}

.entry-content .alignright {
	float: right;
	margin: 0.3em 0 1em 1.6em;
}

.entry-content .aligncenter {
	display: block;
	margin-inline: auto;
}

.entry-content::after {
	content: "";
	display: block;
	clear: both;
}

.wp-caption,
.entry-content figure {
	max-width: 100%;
}

.wp-caption-text,
.entry-content figcaption {
	color: var(--quiet);
	font-size: 0.88rem;
	line-height: 1.6;
}

/* ---------- Lists of posts: title, dotted leader, date ---------- */

.news > h2 {
	margin: 0 0 0.6rem;
	padding-bottom: 0.35em;
	border-bottom: 1px solid var(--ink);
	font-family: var(--mincho);
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.5;
}

.toc {
	margin: 0;
	padding: 0;
	list-style: none;
}

.toc a {
	display: flex;
	align-items: baseline;
	gap: 0.75em;
	padding: 0.5em 0;
	line-height: 1.6;
	text-decoration: none;
}

.toc-title {
	min-width: 0;
}

.toc-leader {
	flex: 1 1 2em;
	min-width: 2em;
	border-bottom: 1px dotted var(--ink);
	transform: translateY(-0.3em);
}

.toc time {
	flex: none;
	color: var(--quiet);
	font-family: var(--latin);
	font-size: 0.92rem;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

.toc a:hover time,
.toc a:hover .toc-leader {
	color: var(--deep);
	border-bottom-color: var(--deep);
}

.pagination,
.comments-pagination,
.post-nav {
	margin-top: 2.5rem;
}

.pagination .nav-links,
.post-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
}

.pagination .page-numbers {
	padding: 0.2em 0.7em;
	border: 1px solid var(--hair);
	font-family: var(--latin);
	font-variant-numeric: tabular-nums;
	text-decoration: none;
}

.pagination .current {
	border-color: var(--ink);
	background: var(--ink);
	color: #fff;
}

.post-nav {
	justify-content: space-between;
	padding-top: 1.2rem;
	border-top: 1px solid var(--ink);
	font-size: 0.94rem;
}

/* ---------- Sidebar ---------- */

.sidebar {
	font-size: 0.94rem;
	line-height: 1.75;
}

.widget + .widget {
	margin-top: 2.6rem;
}

.widget-title,
.sidebar .widget-title h3 {
	margin: 0 0 0.9rem;
	padding-bottom: 0.4em;
	border-bottom: 1px solid var(--ink);
	font-family: var(--mincho);
	font-size: 1.1rem;
	font-weight: 600;
	line-height: 1.5;
}

.widget ul {
	margin: 0 0 1.2em;
	padding: 0;
	list-style: none;
}

.widget li {
	padding: 0.42em 0;
	border-bottom: 1px solid var(--hair);
}

.widget p {
	margin: 0 0 0.5em;
}

.widget .post-date {
	display: block;
	color: var(--quiet);
	font-family: var(--latin);
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
}

.widget a {
	text-decoration: none;
}

.widget a:hover {
	text-decoration: underline;
}

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

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="number"],
input[type="password"],
select,
textarea {
	width: 100%;
	max-width: 100%;
	padding: 0.6em 0.8em;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: var(--sheet);
	color: var(--ink);
	font: inherit;
	line-height: 1.6;
}

textarea {
	min-height: 10em;
}

label {
	font-weight: 700;
}

.search-form {
	display: flex;
	gap: 8px;
	max-width: 28rem;
}

.search-form label {
	flex: 1;
}

.wpcf7 form p {
	margin: 0 0 1.4em;
}

.wpcf7-not-valid-tip,
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output {
	color: #b3261e;
}

.wpcf7 form .wpcf7-response-output {
	margin: 1.5em 0 0;
	padding: 0.8em 1em;
	border: 1px solid var(--ink);
}

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

.comments {
	margin-top: 4rem;
}

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

.comment-list .comment-body {
	padding: 1.2em 0;
	border-bottom: 1px solid var(--hair);
}

.comment-list .children {
	padding-left: 1.5em;
	list-style: none;
}

/* ---------- Footer ---------- */

.site-footer {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 18px 40px;
	align-items: center;
	padding: 32px var(--gutter) 36px;
	border-top: 1px solid var(--ink);
	font-size: 0.9rem;
}

.footer-brand {
	display: block;
	line-height: 0;
}

.footer-brand img {
	display: block;
	width: auto;
	height: 36px;
}

.footer-nav a {
	text-decoration: none;
}

.footer-nav a:hover {
	text-decoration: underline;
}

.copyright {
	margin: 0;
	color: var(--quiet);
	font-family: var(--latin);
	letter-spacing: 0.03em;
}

@media (min-width: 860px) {
	.site-footer {
		grid-template-columns: auto minmax(0, 1fr) auto;
	}
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
	body {
		line-height: 1.85;
	}

	.brand img,
	.custom-logo-link img {
		height: 46px;
	}

	.site-nav ul {
		gap: 2px 18px;
	}

	/* Too narrow for a title and a date on one line: the date goes under the title */
	.toc a {
		flex-wrap: wrap;
		gap: 0.1em 0.75em;
	}

	.toc-title {
		flex: 1 0 100%;
	}

	.toc-leader {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

/* ---------- On paper ---------- */

@media print {
	body {
		background: none;
		font-size: 10.5pt;
	}

	.sheet {
		width: auto;
		max-width: none;
		margin: 0;
	}

	.mark,
	.site-nav,
	.sidebar,
	.opening-art,
	.footer-nav,
	.post-nav,
	.pagination,
	.comments,
	.skip-link {
		display: none;
	}

	.columns,
	.opening,
	.site-header,
	.site-footer {
		padding-inline: 0;
	}

	.columns {
		display: block;
	}

	a {
		text-decoration: none;
	}

	.entry-content pre,
	.entry-content table {
		break-inside: avoid;
	}
}
