/*
Theme Name: Aditya Blog
Theme URI: https://alvion.in/
Author: Alvion — Algorithmic Vision Online
Author URI: https://alvion.in/
Description: Ink-on-paper editorial block theme for long-form writing. Self-hosted variable type, hairline rules, square corners, no shadows, no page builder. Every layout, colour and menu is editable from wp-admin without touching code.
Requires at least: 6.6
Tested up to: 6.7
Requires PHP: 8.0
Version: 1.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: aditya-blog
Tags: blog, one-column, custom-colors, custom-menu, editor-style, block-patterns, full-site-editing, accessibility-ready, translation-ready
*/

/*
 * DESIGN DIRECTION — "Ink & Paper"
 *
 * Warm paper ground, near-black ink, one vermillion accent used sparingly.
 * Square corners everywhere; depth comes from hairline rules and hard offset
 * blocks, never from blur. Display type is Bricolage Grotesque at 800 with
 * negative tracking; reading type is Source Serif 4, self-hosted.
 *
 * Nearly all styling lives in theme.json so the Site Editor can override it.
 * Only rules theme.json cannot express belong in this file.
 */

/* --- Accessibility: skip link ------------------------------------------- */
.skip-link.screen-reader-text {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	border: 0;
	border-radius: 0;
	clip-path: inset(50%);
	/* Through `--wp--custom--*` first, like `site.css`. Reaching straight for
	   the preset looks equivalent and is not: WordPress strips
	   `settings.typography.fontFamilies` out of user global styles, so a
	   style variation cannot repoint `sans` or `serif` and every rule in
	   this file kept drawing the theme default while the variation looked
	   applied. The fallback is the preset, so nothing changes by default. */
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	left: 0;
	line-height: normal;
	padding: 16px 24px;
	position: absolute;
	text-decoration: none;
	top: 0;
	width: auto;
	z-index: 100000;
}

.skip-link.screen-reader-text:focus {
	clip-path: none;
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: -6px;
}

/* --- Reading comfort ----------------------------------------------------- */
body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	font-synthesis-weight: none;
}

.entry-content > * {
	overflow-wrap: break-word;
}

/* Numbers in meta rows and tables line up column to column. */
.wp-block-post-date,
.wp-block-table,
.adb-reading-time {
	font-variant-numeric: tabular-nums;
}

.is-style-reading-measure {
	max-width: 64ch;
	margin-inline: auto;
}

/* --- Tap targets: studio rule is 44px minimum --------------------------- */
.wp-block-navigation .wp-block-navigation-item__content,
.wp-block-social-link-anchor,
.wp-block-post-terms a,
.wp-element-button,
.wp-block-button__link {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
}

.wp-block-navigation .wp-block-navigation-item__content {
	padding-block: 0.5rem;
	position: relative;
}

/* Nav links grow a vermillion rule instead of swapping colour. */
.wp-block-navigation .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 100%;
	bottom: 0.35rem;
	height: 2px;
	background: var(--wp--preset--color--primary);
	transition: right 180ms ease;
}

.wp-block-navigation .wp-block-navigation-item__content:hover::after,
.wp-block-navigation .current-menu-item .wp-block-navigation-item__content::after {
	right: 0;
}

.wp-block-social-links .wp-social-link {
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* --- Buttons: square, hard, no lift -------------------------------------- */
.wp-block-button__link,
.wp-element-button {
	border-radius: 0;
	box-shadow: none;
	transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
	cursor: pointer;
}

.wp-block-button.is-style-outline > .wp-block-button__link {
	border: 1px solid currentColor;
	background: transparent;
	color: var(--wp--preset--color--contrast);
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

/* --- Zero layout shift: images reserve their box ------------------------ */
.wp-block-post-featured-image img,
.wp-block-image img {
	height: auto;
	max-width: 100%;
	border-radius: 0;
}

.wp-block-post-featured-image {
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--contrast);
}

.wp-block-avatar img {
	border-radius: 0;
	border: 1px solid var(--wp--preset--color--contrast);
}

/* --- Table of contents --------------------------------------------------- */
.adb-toc {
	background: transparent;
	border: 0;
	border-top: 2px solid var(--wp--preset--color--contrast);
	border-radius: 0;
	padding: var(--wp--preset--spacing--20) 0 0;
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
	font-size: var(--wp--preset--font-size--small);
}

.adb-toc__title {
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	font-size: 0.6875rem;
	color: var(--wp--preset--color--muted);
	margin: 0 0 0.5rem;
}

.adb-toc ol {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: adb-toc;
}

.adb-toc li {
	margin: 0;
	counter-increment: adb-toc;
}

.adb-toc a {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	min-height: 44px;
	padding-block: 0.35rem;
	color: var(--wp--preset--color--muted);
	text-decoration: none;
	line-height: 1.35;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.adb-toc a::before {
	content: counter(adb-toc, decimal-leading-zero);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: var(--wp--preset--color--border);
	flex: none;
}

.adb-toc li.is-h3 a {
	padding-inline-start: 1.6rem;
}

.adb-toc a:hover,
.adb-toc a:focus,
.adb-toc a.is-active {
	color: var(--wp--preset--color--contrast);
}

.adb-toc a:hover::before,
.adb-toc a.is-active::before {
	color: var(--wp--preset--color--primary);
}

.adb-toc a.is-active {
	font-weight: 600;
}

@media (min-width: 1100px) {
	.adb-toc.is-sticky {
		position: sticky;
		top: 2.5rem;
		max-height: calc(100vh - 5rem);
		overflow-y: auto;
	}
}

.entry-content :is(h2, h3)[id] {
	scroll-margin-top: 2.5rem;
}

/* --- Meta ---------------------------------------------------------------- */
.adb-reading-time {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* --- Long-form typography ------------------------------------------------ */
.wp-block-post-content > p:first-of-type::first-letter,
.entry-content > p.has-drop-cap::first-letter {
	font-family: var(--wp--custom--display, var(--wp--custom--sans, var(--wp--preset--font-family--sans)));
	font-weight: 800;
	font-size: 3.6em;
	line-height: 0.78;
	float: left;
	margin: 0.08em 0.12em 0 0;
	color: var(--wp--preset--color--primary);
}

.wp-block-post-content :is(h2, h3) {
	font-family: var(--wp--custom--display, var(--wp--custom--sans, var(--wp--preset--font-family--sans)));
}

/* A hairline above every H2 marks the section break. */
.wp-block-post-content > h2 {
	border-top: 1px solid var(--wp--preset--color--contrast);
	padding-top: var(--wp--preset--spacing--20);
}

/* --- Registered block styles -------------------------------------------- */
.wp-block-group.is-style-card {
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--contrast);
	border-radius: 0;
	padding: var(--wp--preset--spacing--40);
	box-shadow: var(--wp--preset--shadow--card);
}

p.is-style-lede {
	font-family: var(--wp--custom--serif, var(--wp--preset--font-family--serif));
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.5;
	color: var(--wp--preset--color--muted);
}

ul.is-style-checklist {
	list-style: none;
	padding-inline-start: 0;
}

ul.is-style-checklist li {
	padding-inline-start: 1.6rem;
	position: relative;
	margin-block: 0.5rem;
}

ul.is-style-checklist li::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 0.62em;
	width: 0.7rem;
	height: 2px;
	background: var(--wp--preset--color--primary);
}

.wp-block-image.is-style-rounded-shadow img {
	border-radius: 0;
	border: 1px solid var(--wp--preset--color--contrast);
	box-shadow: var(--wp--preset--shadow--card);
}

/* --- Share bar ----------------------------------------------------------- */
.adb-share {
	gap: 0.5rem;
	flex-wrap: wrap;
}

.adb-share .wp-block-button__link {
	font-size: 0.6875rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding: 0.7rem 1.1rem;
}

/* --- Tables: ledger, not card ------------------------------------------- */
.wp-block-table {
	overflow-x: auto;
}

.wp-block-table table {
	min-width: 32rem;
	border-collapse: collapse;
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
}

.wp-block-table :is(th, td) {
	padding: 0.7rem 0.9rem;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.wp-block-table thead th {
	border-bottom: 2px solid var(--wp--preset--color--contrast);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-align: left;
}

.wp-block-table figcaption {
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
}

/* --- Quotes -------------------------------------------------------------- */
.wp-block-pullquote cite {
	display: block;
	margin-top: 0.9rem;
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	font-style: normal;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

/* --- Comments ------------------------------------------------------------ */
.wp-block-comment-author-name a {
	text-decoration: none;
}

.comment-form :is(input[type="text"], input[type="email"], input[type="url"], textarea) {
	width: 100%;
	max-width: 100%;
	padding: 0.8rem;
	border: 1px solid var(--wp--preset--color--contrast);
	border-radius: 0;
	background: var(--wp--preset--color--base);
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
	font-size: var(--wp--preset--font-size--small);
}

.comment-form :is(input, textarea):focus {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 1px;
}

.comment-form label {
	display: block;
	margin-bottom: 0.35rem;
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

/* --- Search -------------------------------------------------------------- */
.wp-block-search__input {
	border: 1px solid var(--wp--preset--color--contrast);
	border-radius: 0;
	padding: 0.7rem 0.8rem;
	background: var(--wp--preset--color--base);
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
}

.wp-block-search__button {
	border-radius: 0;
	min-height: 44px;
	min-width: 44px;
	border: 1px solid var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	cursor: pointer;
}

.wp-block-search__button:hover {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}

/* --- Pagination ---------------------------------------------------------- */
.wp-block-query-pagination {
	border-top: 2px solid var(--wp--preset--color--contrast);
	padding-top: var(--wp--preset--spacing--20);
	font-family: var(--wp--custom--sans, var(--wp--preset--font-family--sans));
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* --- Respect reduced motion --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

html {
	scroll-behavior: smooth;
}

/* -------------------------------------------------------------------------
 * Where WordPress's markup and the drawing disagree
 *
 * The design lives in assets/css/site.css, copied whole from the file the
 * prototype was judged on. These few rules exist only because core blocks
 * emit a different element than the drawing assumed, and re-drawing the
 * design to match WordPress would be the wrong way round.
 * ---------------------------------------------------------------------- */

/*
 * The full stop after the wordmark is vermillion. In the drawing it is a
 * <span>; core/site-title emits a bare anchor, so it becomes a pseudo-element
 * — and stays out of the accessibility tree, which is where a decorative full
 * stop belongs anyway.
 *
 * This only applies where the wordmark is still TEXT — the footer. The masthead
 * now carries the logo image, and a drawn full stop after a drawn lockup would
 * be a second designer's opinion stapled onto the first.
 */
.wp-block-site-title.wordmark a::after {
	content: ".";
	color: var(--vermillion);
	margin-left: 0.15em;
}

/*
 * The masthead lockup. core/site-logo emits its own wrapper, so the rules above
 * — written for core/site-title — do not reach it and it needs its own.
 *
 * `height: auto` is not decoration: the block prints width AND height on the
 * <img>, and the 44px min-height below would otherwise stretch the mark.
 */
.wp-block-site-logo.wordmark {
	margin: 0;
	line-height: 0;
}

.wp-block-site-logo.wordmark a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}

.wp-block-site-logo.wordmark img {
	display: block;
	width: 150px;
	height: auto;
	max-width: 100%;
}

/* Narrow phones: the tools bar already competes for the row. */
@media (max-width: 30rem) {
	.wp-block-site-logo.wordmark img {
		width: 124px;
	}
}

.wp-block-site-title.wordmark {
	margin: 0;
}

.wp-block-site-title.wordmark a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	text-decoration: none;
	color: inherit;
}

/*
 * The search control is one square outlined button in the drawing. core/search
 * in button-only mode renders a filled button and a field that is hidden until
 * it is used, so the button is restyled and the field is given the same square
 * treatment when it opens.
 */
.topbar__search {
	margin: 0;
}

.topbar__search .wp-block-search__button {
	width: 44px;
	height: 44px;
	min-height: 44px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
}

.topbar__search .wp-block-search__button:hover,
.topbar__search .wp-block-search__button:focus-visible {
	background: var(--ink);
	color: var(--paper);
}

.topbar__search .wp-block-search__button svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.topbar__search .wp-block-search__input {
	border: 1px solid var(--rule);
	border-radius: 0;
	background: var(--paper);
	font-family: var(--sans);
	font-size: 0.8125rem;
	padding: 0.5rem 0.75rem;
	min-height: 44px;
}

/* The navigation block carries the drawing's own spacing and type. */
.wp-block-navigation.nav {
	gap: var(--sp-30);
}

.wp-block-navigation.nav .wp-block-navigation-item__content {
	font-family: var(--sans);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--ink);
	min-height: 44px;
	display: inline-flex;
	align-items: center;
}

/*
 * The takeaways box and the callout.
 *
 * The block patterns carry inline styles, because that is how the block editor
 * stores colour and spacing, and an inline style beats a stylesheet. Where the
 * drawing and the block disagree the drawing wins — so these few properties
 * are forced. The only other !important in this file is the
 * prefers-reduced-motion block, where overriding everything is the point.
 *
 * In the drawing: takeaways is paper with a hairline ink border and a hard
 * 4px offset, no blur. The callout is the marker yellow with the same hairline.
 *
 * Both selectors matter. `.entry` is the article on the site; the block
 * editor has no such wrapper, so a box that looked right to a reader looked
 * pink to the person writing it. Photographing the two editors side by side
 * is what made that obvious.
 */
.entry .wp-block-group.has-primary-soft-background-color,
.editor-styles-wrapper .wp-block-group.has-primary-soft-background-color {
	background: var(--paper) !important;
	border: 1px solid var(--ink) !important;
	border-left-width: 1px !important;
	box-shadow: 4px 4px 0 0 var(--ink);
	font-family: var(--sans);
	font-size: 1rem;
}

.entry .wp-block-group.has-highlight-background-color,
.editor-styles-wrapper .wp-block-group.has-highlight-background-color {
	background: var(--marker) !important;
	border: 1px solid var(--ink) !important;
	font-family: var(--sans);
	font-size: 1rem;
}

.entry .wp-block-group.has-highlight-background-color p,
.entry .wp-block-group.has-primary-soft-background-color li,
.editor-styles-wrapper .wp-block-group.has-highlight-background-color p,
.editor-styles-wrapper .wp-block-group.has-primary-soft-background-color li {
	color: var(--ink);
}

/* The label at the top of either box reads as a label, not a heading. */
.entry .wp-block-group.has-primary-soft-background-color h6,
.editor-styles-wrapper .wp-block-group.has-primary-soft-background-color h6 {
	font-family: var(--sans);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--vermillion);
	margin: 0 0 var(--sp-20);
}
