/* Hallmark · genre: editorial · macrostructure: Long Document · theme: custom · enrichment: public-domain ornaments (Vibert headpieces, Aldine leaf) + Augsburg initial logo · nav: N9 · footer: Ft6 */
/*
Theme Name: Dinanti
Description: A quiet reading theme for a personal essay blog. One column, warm paper, forest links.
Author: Dinanti
Version: 1.0.0
Requires at least: 7.0
Tested up to: 7.1
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: dinanti
*/

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

html,
body {
	overflow-x: clip;
}

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

/* ---------- Ornaments ----------
 * Real printer's ornaments, all public domain (sources in assets/ornaments/CREDITS.md).
 * Each SVG is used as a mask, so its colour always comes from the theme tokens.
 * The rule: Vibert opens, the Aldine leaf breaks and closes. At most one headpiece per page.
 *   vibert-foliage.svg  — headpiece above an essay title (single essay, newest essay on the home page)
 *   vibert-clover.svg   — headpiece above a plain page title (About)
 *   floral-heart.svg    — section break inside an essay (forest), end mark after the last paragraph (ember) */
.essay__head::before,
.home__latest:has(.wp-block-post)::before,
.page__head::before {
	content: "";
	display: block;
	width: min(13.75rem, 100%);
	aspect-ratio: 469.2 / 68.6;
	margin-block-end: var(--space-lg);
	background: var(--color-accent);
	-webkit-mask: url("assets/ornaments/vibert-foliage.svg") left center / contain no-repeat;
	mask: url("assets/ornaments/vibert-foliage.svg") left center / contain no-repeat;
}

.home__latest:has(.wp-block-post)::before {
	margin-block-end: var(--space-md);
}

.page__head::before {
	aspect-ratio: 468 / 70.1;
	-webkit-mask-image: url("assets/ornaments/vibert-clover.svg");
	mask-image: url("assets/ornaments/vibert-clover.svg");
}

.wp-block-separator::before {
	content: "";
	display: block;
	width: 1.5rem;
	aspect-ratio: 173 / 179;
	margin-inline: auto;
	background: var(--color-accent);
	-webkit-mask: url("assets/ornaments/floral-heart.svg") center / contain no-repeat;
	mask: url("assets/ornaments/floral-heart.svg") center / contain no-repeat;
}

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

::selection {
	background: var(--color-ember-wash);
	color: var(--color-ink);
}

p,
li,
figcaption {
	text-wrap: pretty;
	hyphens: manual;
}

h1,
h2,
h3 {
	text-wrap: balance;
	overflow-wrap: break-word;
}

/* Links read as links: underlined, offset, thicker on hover. No transition: the change is instant. */
a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
	text-decoration-color: color-mix(in oklch, currentColor 45%, transparent);
}

a:hover {
	text-decoration-thickness: 2px;
	text-decoration-color: currentColor;
}

:where(a, button, input, textarea, select, summary):focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 3px;
	border-radius: var(--radius-hair);
}

mark:not([style]),
mark.has-inline-color[style*="rgba(0, 0, 0, 0)"] {
	background: linear-gradient(transparent 55%, var(--color-ember-wash) 55%);
	color: inherit;
	padding-inline: 0.08em;
}

/* ---------- Header · N9 edge-aligned minimal ---------- */

.site-header {
	padding-block: var(--space-lg) var(--space-xl);
	padding-inline: var(--space-lg);
}

.site-header__row {
	max-width: 64rem;
	margin-inline: auto;
	align-items: baseline;
}

.wordmark {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--text-md);
	font-weight: 600;
	line-height: 1;
}

.wordmark a {
	color: var(--color-ink);
	text-decoration: none;
}

/* The name opens like a chapter: a late-15th-century Augsburg initial, in forest, stands in for the D.
 * The real letter stays in the markup for screen readers and search engines. */
.wordmark__initial {
	display: inline-block;
	width: 1.52em;
	height: 1.75em;
	margin-inline-end: 0.03em;
	vertical-align: -0.1em;
	background: var(--color-accent);
	-webkit-mask: url("assets/logo/dinanti-initial.svg") center / contain no-repeat;
	mask: url("assets/logo/dinanti-initial.svg") center / contain no-repeat;
}

.site-header__link {
	margin: 0;
	font-size: var(--text-sm);
	font-weight: 600;
	letter-spacing: 0.01em;
}

.site-header__link a {
	color: var(--color-ink);
}

/* ---------- Home ---------- */

/* The tagline is the blog's own voice, so it is set in forest like the logo D and the headpiece.
 * Essay titles stay in ink, so the two never read as the same thing. It shares the reading column's left edge. */
.home__lede {
	margin-block: var(--space-xl) var(--space-2xl);
	font-family: var(--font-display);
	font-size: var(--text-display);
	font-weight: 300;
	line-height: 1.08;
	letter-spacing: -0.02em;
	color: var(--color-accent);
}

.home__latest .wp-block-post {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
}

.home__latest .wp-block-post-date {
	margin: 0;
}

.home__latest-title {
	margin: 0;
	font-size: var(--text-xl);
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: -0.015em;
	max-width: 24ch;
}

.home__latest .wp-block-post-featured-image {
	margin-block: var(--space-sm) var(--space-xs);
}

.home__latest .wp-block-post-excerpt {
	margin: 0;
	color: var(--color-ink-soft);
}

.home__latest .wp-block-post-excerpt__excerpt {
	margin: 0;
}

.wp-block-post-excerpt__more-text {
	margin-block-start: var(--space-sm);
}

.wp-block-post-excerpt__more-link {
	font-weight: 600;
	font-size: var(--text-sm);
}

.wp-block-post-excerpt__more-link::after {
	content: " →";
}

.home__empty {
	color: var(--color-muted);
}

/* "Earlier" only exists once there is a second essay. Space, not an ornament, sets it apart. */
.home__earlier {
	margin-block-start: var(--space-2xl);
}

.home__earlier:not(:has(.wp-block-post)) {
	display: none;
}

.home__earlier-head {
	margin-block-end: var(--space-md);
	font-size: var(--text-md);
	font-weight: 600;
}

/* ---------- Essay index rows (home "Earlier", archives) ---------- */

.index-list {
	gap: 0 !important;
}

.index-list > .wp-block-post {
	border-top: var(--rule-hair);
	padding-block: var(--space-md);
	margin: 0;
}

.index-list > .wp-block-post:last-child {
	border-bottom: var(--rule-hair);
}

.index-row {
	gap: var(--space-lg);
}

.index-row .wp-block-post-title {
	margin: 0;
	font-size: var(--text-md);
	font-weight: 400;
	line-height: 1.3;
}

.index-row .wp-block-post-date {
	flex-shrink: 0;
	margin: 0;
	padding-top: 0.3em;
	font-variant-numeric: tabular-nums;
}

/* ---------- Essay ---------- */

.essay__head {
	margin-block: var(--space-xl) var(--space-xl);
}

.essay__head .wp-block-post-title {
	margin: 0 0 var(--space-lg);
}

.essay__byline {
	gap: 0 var(--space-xs);
	color: var(--color-muted);
	font-size: var(--text-sm);
}

.essay__byline > * {
	margin: 0;
}

.essay__byline .wp-block-post-author__content {
	display: flex;
	gap: 0.3em;
}

.essay__byline .wp-block-post-author__byline,
.essay__byline .wp-block-post-author__name {
	margin: 0;
	font-size: inherit;
}

.essay__byline .wp-block-post-author__name {
	color: var(--color-ink);
	font-weight: 600;
}

.essay__byline .essay__dot {
	color: var(--color-rule);
}

.essay .wp-block-post-featured-image {
	margin-block: 0 var(--space-xl);
}

.wp-block-post-featured-image img,
.essay__body .wp-block-image img {
	border-radius: var(--radius-hair);
}

/* Body copy rhythm: generous paragraphs, headings that open a little space before them. */
.essay__body > * + * {
	margin-block-start: 1.15em;
}

.essay__body > :where(h2, h3, h4) {
	margin-block-start: var(--space-xl);
	margin-block-end: 0;
}

.essay__body > :where(h2, h3, h4) + * {
	margin-block-start: 0.6em;
}

.essay__body :where(ul, ol) {
	padding-inline-start: 1.25em;
}

.essay__body li + li {
	margin-block-start: 0.35em;
}

.essay__body li::marker {
	color: var(--color-muted);
}

.essay__body > .wp-block-image,
.essay__body > figure {
	margin-block: var(--space-xl);
}

.wp-block-image figcaption,
.wp-element-caption {
	margin-block-start: var(--space-xs);
	text-align: start;
}

/* External links carry a small arrow so readers know they leave the page. */
.essay__body a[href^="http"]:not([href*="dinanti.berkhabar.com"]):not([href*="localhost"])::after {
	content: "\2009↗" / "";
	font-size: 0.8em;
}

/* Drop cap, only where the writer switches it on in the editor. */
.has-drop-cap:not(:focus)::first-letter {
	font-family: var(--font-display);
	font-weight: 400;
	font-size: 4.2em;
	line-height: 0.82;
	margin: 0.06em 0.1em 0 0;
	color: var(--color-ink);
}

/* End mark: a small ember leaf closes the essay, the way a book closes a chapter. */
.essay .essay__body > p:last-child::after {
	content: "";
	display: inline-block;
	width: 0.95em;
	height: 0.95em;
	margin-inline-start: 0.35em;
	vertical-align: -0.12em;
	background: var(--color-ember);
	-webkit-mask: url("assets/ornaments/floral-heart.svg") center / contain no-repeat;
	mask: url("assets/ornaments/floral-heart.svg") center / contain no-repeat;
}

/* Quotes: a forest hairline, set in the display face. */
.wp-block-quote {
	border-inline-start: 2px solid var(--color-accent);
	padding-inline-start: var(--space-lg);
	margin-inline: 0;
}

.wp-block-quote p {
	margin: 0;
}

.wp-block-quote cite {
	display: block;
	margin-block-start: var(--space-xs);
	font-family: var(--font-body);
	font-size: var(--text-sm);
	font-style: normal;
	color: var(--color-muted);
}

.wp-block-pullquote {
	border-block: var(--rule-hair);
	padding-block: var(--space-xl);
	text-align: start;
}

/* A separator inside an essay becomes a single forest leaf (see the ornament block above). */
.wp-block-separator,
.wp-block-separator.has-alpha-channel-opacity {
	border: 0;
	height: auto;
	opacity: 1;
	margin-block: var(--space-2xl) !important;
	background: none !important;
}

.essay__body code {
	font-size: 0.9em;
	background: var(--color-paper-2);
	padding: 0.1em 0.3em;
	border-radius: var(--radius-hair);
}

.essay__body table {
	font-size: var(--text-sm);
	font-variant-numeric: tabular-nums;
}

/* End of essay: a hairline, a pointer to the writer, then the older essay. */
.essay__end {
	margin-block-start: var(--space-2xl);
	padding-block-start: var(--space-lg);
	border-top: var(--rule-hair);
	font-size: var(--text-sm);
	gap: var(--space-sm);
}

.essay__end p {
	margin: 0;
}

.essay__end .wp-block-post-terms {
	color: var(--color-muted);
}

.post-navigation-link-previous,
.wp-block-post-navigation-link {
	font-size: var(--text-sm);
}

/* ---------- Plain pages and archives ---------- */

.page__head .wp-block-post-title,
.archive__head .wp-block-query-title {
	margin-block: var(--space-xl) var(--space-xl);
}

.page__head {
	margin-block-start: var(--space-xl);
}

.page__head .wp-block-post-title {
	margin-block-start: 0;
}

.page__credits {
	margin-block-start: var(--space-2xl) !important;
	padding-block-start: var(--space-md);
	border-top: var(--rule-hair);
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.page__credits a {
	color: var(--color-muted);
}

.archive__head .wp-block-query-title {
	font-size: var(--text-xl);
	font-weight: 400;
}

/* ---------- 404 ---------- */

.not-found {
	min-height: 50vh;
	padding-block: var(--space-2xl);
}

.not-found h1 {
	margin-block-end: var(--space-lg);
}

/* ---------- Footer · Ft6 letter close ---------- */

.site-footer {
	margin-block-start: var(--space-2xl);
	padding-block: var(--space-xl) var(--space-xl);
}

.site-footer__close {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--text-md);
	line-height: 1.4;
	color: var(--color-ink-soft);
}

.site-footer__sign {
	font-weight: 600;
	color: var(--color-ink);
}

.site-footer__ps {
	margin-block-start: var(--space-md);
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.site-footer__ps a {
	color: var(--color-muted);
}

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

@media (max-width: 40rem) {
	.home__lede {
		margin-block: var(--space-md) var(--space-xl);
	}

	.index-row {
		flex-direction: column;
		gap: var(--space-2xs);
	}

	.index-row .wp-block-post-date {
		padding-top: 0;
	}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 150ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 150ms !important;
		scroll-behavior: auto !important;
	}
}
