/*
Theme Name: AIAS
Theme URI: https://github.com/adikesava-institute/website
Author: Adikesava Institute of Advanced Studies
Author URI: https://adikesava.example
Description: Block theme for the Adikesava Institute of Advanced Studies — Centre for Philosophy, Culture and Religion. Maroon and cream academic design system with full IAST diacritic support.
Requires at least: 6.8
Tested up to: 7.1
Requires PHP: 8.2
Version: 0.4.7
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: aias
Tags: block-theme, full-site-editing, education, one-column, block-patterns, accessibility-ready
*/

/*
 * Design tokens live in theme.json. This file carries only what theme.json
 * cannot express: the metric-matched fallback faces below, and the print
 * stylesheet. Layout and component rules live in assets/css/theme.css, which
 * is shared with the block editor.
 */

/* -------------------------------------------------------------------------
 * Metric-matched fallback faces
 *
 * font-display: swap paints a fallback first and swaps when the webfont
 * arrives. Without these overrides the text reflows on swap, and that reflow
 * is cumulative layout shift on every page — worst on the slow connections
 * half this audience is on.
 *
 * Values computed from the SHIPPED subset files by
 * scripts/font-fallback-metrics.mjs. Recompute and repaste after any change
 * to scripts/build-fonts.sh. Do not hand-edit.
 * ------------------------------------------------------------------------- */

/* EB Garamond → Times New Roman.
   Generated by scripts/font-fallback-metrics.mjs — do not hand-edit. */
@font-face {
	font-family: "EB Garamond Fallback";
	src: local("Times New Roman");
	size-adjust: 94.8%;
	ascent-override: 106.22%;
	descent-override: 31.43%;
	line-gap-override: 0%;
}

/* Source Sans 3 → Arial.
   Generated by scripts/font-fallback-metrics.mjs — do not hand-edit. */
@font-face {
	font-family: "Source Sans 3 Fallback";
	src: local("Arial");
	size-adjust: 94.59%;
	ascent-override: 108.26%;
	descent-override: 42.29%;
	line-gap-override: 0%;
}

/* Source Serif 4 → Georgia.
   Generated by scripts/font-fallback-metrics.mjs — do not hand-edit. */
@font-face {
	font-family: "Source Serif 4 Fallback";
	src: local("Georgia");
	size-adjust: 107.66%;
	ascent-override: 96.23%;
	descent-override: 31.12%;
	line-gap-override: 0%;
}

/* -------------------------------------------------------------------------
 * Print
 *
 * Print is a designed state here, not an afterthought. This audience prints
 * programme pages, event pages, reading lists, directions and the residency
 * guidelines — PRODUCT.md lists printing as a real workflow, and the component
 * catalogue gives print its own row.
 *
 * Lives in style.css rather than theme.css because none of it is expressible
 * as a theme.json token and none of it should reach the block editor.
 * ------------------------------------------------------------------------- */

@media print {

	/* Navigation, calls to action and the contents rail carry nothing on paper. */
	.aias-header,
	.aias-utility,
	.aias-consent,
	.aias-rail,
	.wp-block-navigation,
	.wp-block-search,
	.wp-block-buttons,
	.wp-block-query-pagination,
	.has-maroon-900-background-color,
	.has-maroon-700-background-color {
		display: none !important;
	}

	/* One face, black on white: colour costs ink and adds nothing here. */
	body {
		background: #fff !important;
		color: #000 !important;
		font-family: "Source Serif 4", Georgia, serif !important;
		font-size: 12pt !important;
		line-height: 1.5 !important;
	}

	:is(h1, h2, h3, h4, h5, h6) {
		color: #000 !important;
		page-break-after: avoid;
		break-after: avoid;
	}

	/* The measure is a screen constraint; on paper the column is the page. */
	.is-style-longform p,
	.wp-block-post-content p {
		max-inline-size: none !important;
	}

	a {
		color: #000 !important;
		text-decoration: underline;
	}

	/*
	 * An underlined word is useless on paper. Print the destination after every
	 * external link — but not after internal ones, which would bury the page in
	 * its own domain, and not after anchors or mailto.
	 */
	a[href^="http"]:not([href*="adikesava"])::after {
		content: " <" attr(href) ">";
		font-size: 10pt;
		word-break: break-all;
	}

	table,
	figure,
	blockquote {
		page-break-inside: avoid;
		break-inside: avoid;
	}

	thead {
		display: table-header-group;
	}

	img {
		max-width: 100% !important;
	}

	.aias-print-footer {
		display: block !important;
		margin-top: 1.5em;
		padding-top: 0.5em;
		border-top: 1px solid #000;
		font-size: 9pt;
	}

	.aias-print-footer span {
		word-break: break-all;
	}
}
