/*
Theme Name: Twenty Twenty-Five TSAI
Theme URI: https://turmansolutions.ai/themes/twentytwentyfive-tsai/
Author: Turman Solutions
Author URI: https://turmansolutions.ai
Description: A dark variant of the Twenty Twenty-Five theme. Inherits all templates, patterns, and behavior from the parent while swapping the color palette for a dark background and light text.
Template: twentytwentyfive
Version: 0.1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentytwentyfive-tsai
Tags: dark, one-column, full-site-editing, block-styles, style-variations
*/

/* Code blocks on single posts scroll horizontally instead of widening the
   layout. A <pre> preserves whitespace and won't wrap, so a long line would
   otherwise stretch the element past the content column. Cap it at the column
   width and let overflow scroll. Covers both raw <pre><code> from the
   publishing pipeline and the editor's .wp-block-code. */
body.single .wp-block-post-content pre,
body.single .wp-block-post-content pre.wp-block-code {
	max-width: 100%;
	overflow-x: auto;
}

/* Magnify on hover — featured + inline content images on single posts.
   Gated by .is-magnify-active, toggled by the corner button in assets/js/magnify.js.
   transform-origin is updated by the same script based on cursor position. */
body.single .wp-block-post-featured-image,
body.single .wp-block-post-content .wp-block-image {
	overflow: hidden;
}

body.single .wp-block-post-featured-image.is-magnify-active,
body.single .wp-block-post-content .wp-block-image.is-magnify-active {
	cursor: zoom-in;
}

body.single .wp-block-post-featured-image img,
body.single .wp-block-post-content .wp-block-image img {
	display: block;
	transition: transform 0.25s ease-out;
	will-change: transform;
}

/* Inline alignright (secondary) image layout now lives in the tsai-plugin
   stylesheet (assets/css/tsai-secondary-image.css), so it applies site-wide
   (tsai + scike) from a single place rather than per-theme. */

body.single .wp-block-post-featured-image.is-magnify-active:hover img,
body.single .wp-block-post-content .wp-block-image.is-magnify-active:hover img {
	transform: scale(2.5);
}

.tsai-magnify-toggle {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	cursor: pointer;
	opacity: 0.75;
	transition: opacity 0.15s ease-out, background-color 0.15s ease-out, transform 0.15s ease-out;
}

.tsai-magnify-toggle svg {
	width: 18px;
	height: 18px;
	display: block;
}

.tsai-magnify-toggle:hover,
.tsai-magnify-toggle:focus-visible {
	opacity: 1;
	outline: none;
	background: rgba(0, 0, 0, 0.75);
}

.tsai-magnify-toggle:focus-visible {
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.tsai-magnify-toggle[aria-pressed="true"] {
	background: var(--wp--preset--color--accent, #f0b429);
	color: #000;
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	body.single .wp-block-post-featured-image,
	body.single .wp-block-post-content .wp-block-image {
		cursor: default;
	}
	body.single .wp-block-post-featured-image img,
	body.single .wp-block-post-content .wp-block-image img {
		transition: none;
	}
	body.single .wp-block-post-featured-image.is-magnify-active:hover img,
	body.single .wp-block-post-content .wp-block-image.is-magnify-active:hover img {
		transform: none;
	}
	.tsai-magnify-toggle {
		display: none;
	}
}

/* ── Home magazine layout: keep cards from overlapping/cramping at tablet widths ──
   The home-news pattern (patterns/home-news.php) uses a 25/50/25 wp:columns hero row
   and columnCount grids. Core only stacks the hero at <=781px and only collapses the
   grids at <=600px, leaving a cramped tablet range. Force single/early collapse here.
   The 1024px breakpoint is the single tunable knob. */

/* Hero row: single full-width column until there is real room for 3-up.
   Must also restore flex-wrap, since core sets nowrap!important at >=782px. */
@media (max-width: 1024px) {
	.home-news-hero.wp-block-columns {
		flex-wrap: wrap !important;
	}
	.home-news-hero.wp-block-columns > .wp-block-column {
		flex-basis: 100% !important;
	}
}

/* 3-up grid: 2 columns on tablet, 1 column on phones. */
@media (max-width: 1024px) {
	.home-news-grid-3 .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}
@media (max-width: 700px) {
	.home-news-grid-2 .wp-block-post-template.is-layout-grid,
	.home-news-grid-3 .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
	}
}

/* ── Blog archive list (patterns/blog-archive.php) ──
   Each listing is a horizontal "news list" card: a fixed-width medium thumbnail
   on the left and the title/meta/author body filling the rest. Below 600px the
   row wraps so the thumbnail stacks above the text. */

.archive-listing-item {
	gap: var(--wp--preset--spacing--40);
}
.archive-listing-item .wp-block-post-featured-image {
	flex: 0 0 200px;
	width: 200px;
	margin: 0;
}
.archive-listing-body {
	flex: 1 1 auto;
	min-width: 0;
}

@media (max-width: 600px) {
	.archive-listing-item {
		flex-wrap: wrap;
	}
	.archive-listing-item .wp-block-post-featured-image {
		flex-basis: 100%;
		width: 100%;
	}
}
