/*
Theme Name: Tournament Land Magazine
Theme URI: https://tournamentland.ir/magazine
Description: Child theme of Twenty Twenty-Five, matched to the Tournament Land app's dark palette, Yekan Bakh typography and 0.75rem corner radius. Persian-first and RTL-aware.
Author: Tournament Land
Template: twentytwentyfive
Version: 1.0.0
Requires at least: 6.7
Tested up to: 6.8
Requires PHP: 8.1
Text Domain: tournamentland-mag
*/

/*
 * The palette lives in theme.json and deliberately reuses Twenty Twenty-Five's
 * own slug names rather than inventing new ones, so every block template the
 * parent ships keeps resolving and picks up the brand colors for free:
 *
 *   base      → --background        #0F1419
 *   contrast  → --foreground        #F9FAFB
 *   accent-1  → --primary           #3B82F6
 *   accent-2  → --secondary         #8B5CF6
 *   accent-3  → --card              #131825
 *   accent-4  → --muted             #212634
 *   accent-5  → --muted-foreground  #9CA3AF
 *   accent-6  → --border (solid)    #1E2536
 *
 * Values come from app/globals.css. Change them there first, then mirror here —
 * the app is the source of truth for the brand.
 */

:root {
	/* The app uses a translucent blue border; the solid accent-6 is the fallback
	   for the places where a block needs an opaque color. */
	--tl-border: rgba(59, 130, 246, 0.2);
	--tl-radius: 0.75rem;
	--tl-radius-lg: 1rem;
}

html {
	background-color: #0F1419;
	color-scheme: dark;
}

/* Persian text needs more leading than the Latin default and sits better
   slightly tighter in tracking. */
body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

body:lang(fa),
[dir="rtl"] body {
	letter-spacing: 0;
}

/* Persian numerals inside body copy read better with tabular spacing in
   tables and metadata rows. */
.wp-block-table,
.wp-block-post-date,
.wp-block-post-terms {
	font-variant-numeric: tabular-nums;
}


/* ---------------------------------------------------------------------------
   Cards
   The app renders every list item as a bordered card on --card. Post lists,
   featured images and pull-outs follow the same treatment so a reader moving
   between the two sites does not feel a seam.
   --------------------------------------------------------------------------- */

.wp-block-post-template > li,
.wp-block-latest-posts__list > li {
	background: var(--wp--preset--color--accent-3);
	border: 1px solid var(--tl-border);
	border-radius: var(--tl-radius-lg);
	padding: 1.25rem;
	transition: border-color 0.2s ease, transform 0.2s ease;
}

.wp-block-post-template > li:hover,
.wp-block-latest-posts__list > li:hover {
	border-color: rgba(59, 130, 246, 0.45);
	transform: translateY(-2px);
}

/* Inside a card the title should not inherit the link accent — it reads as a
   heading first, and only the hover reveals it is clickable. */
.wp-block-post-template .wp-block-post-title a {
	color: var(--wp--preset--color--contrast);
}

.wp-block-post-template .wp-block-post-title a:hover {
	color: var(--wp--preset--color--accent-1);
	text-decoration: none;
}

.wp-block-post-excerpt__excerpt {
	color: var(--wp--preset--color--accent-5);
}

.wp-block-post-featured-image img,
.wp-block-image img,
.wp-block-gallery img {
	border-radius: var(--tl-radius);
}


/* ---------------------------------------------------------------------------
   Header / footer chrome
   --------------------------------------------------------------------------- */

.wp-block-template-part > header,
header.wp-block-template-part {
	border-bottom: 1px solid var(--tl-border);
	background: rgba(15, 20, 25, 0.85);
	backdrop-filter: blur(12px);
}

footer.wp-block-template-part,
.wp-block-template-part > footer {
	border-top: 1px solid var(--tl-border);
	background: var(--wp--preset--color--accent-3);
}

/* Navigation: muted until hovered, matching the app's nav. */
.wp-block-navigation .wp-block-navigation-item__content {
	color: var(--wp--preset--color--accent-5);
	font-weight: 600;
}

.wp-block-navigation .wp-block-navigation-item__content:hover,
.wp-block-navigation .current-menu-item .wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.wp-block-navigation__submenu-container {
	background: var(--wp--preset--color--accent-3) !important;
	border: 1px solid var(--tl-border) !important;
	border-radius: var(--tl-radius);
	overflow: hidden;
}


/* ---------------------------------------------------------------------------
   The "back to the platform" call to action.
   Articles link out to pools and game pages; this is the shared button style
   for those links, mirroring the app's primary→secondary gradient button.
   Usage: add the class `tl-cta` to a button block.
   --------------------------------------------------------------------------- */

.wp-block-button.tl-cta .wp-block-button__link {
	background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
	border: none;
	border-radius: var(--tl-radius);
	color: #fff;
	font-weight: 700;
	padding: 0.85rem 1.75rem;
	transition: filter 0.2s ease, transform 0.2s ease;
}

.wp-block-button.tl-cta .wp-block-button__link:hover {
	filter: brightness(1.12);
	transform: translateY(-1px);
}

/* Same treatment for the [tl_link] shortcode, which emits a bare anchor rather
   than a button block. */
a.tl-platform-link {
	background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
	border-radius: var(--tl-radius);
	color: #fff !important;
	display: inline-block;
	font-weight: 700;
	padding: 0.85rem 1.75rem;
	text-decoration: none !important;
	transition: filter 0.2s ease, transform 0.2s ease;
}

a.tl-platform-link:hover {
	filter: brightness(1.12);
	transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
	a.tl-platform-link:hover {
		transform: none;
	}
}


/* ---------------------------------------------------------------------------
   Forms, comments, search
   --------------------------------------------------------------------------- */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea,
select {
	background: #141921;
	border: 1px solid var(--tl-border);
	border-radius: var(--tl-radius);
	color: var(--wp--preset--color--contrast);
	padding: 0.65rem 0.9rem;
}

input:focus,
textarea:focus,
select:focus {
	outline: 2px solid rgba(59, 130, 246, 0.5);
	outline-offset: 1px;
	border-color: var(--wp--preset--color--accent-1);
}

::placeholder {
	color: var(--wp--preset--color--accent-5);
	opacity: 1;
}

.wp-block-comment-template > li {
	background: var(--wp--preset--color--accent-3);
	border: 1px solid var(--tl-border);
	border-radius: var(--tl-radius-lg);
	padding: 1.25rem;
}

.comment-reply-title,
.wp-block-post-comments-form .comment-form label {
	font-weight: 600;
}


/* ---------------------------------------------------------------------------
   Long-form reading
   --------------------------------------------------------------------------- */

.wp-block-post-content > * + * {
	margin-block-start: 1.35em;
}

.wp-block-post-content h2,
.wp-block-post-content h3 {
	margin-block-start: 2.25em;
}

/* Logical properties throughout, so the list indent and quote rule flip with
   the writing direction instead of needing an RTL stylesheet. */
.wp-block-post-content ul,
.wp-block-post-content ol {
	padding-inline-start: 1.5rem;
}

.wp-block-post-content li + li {
	margin-block-start: 0.5rem;
}

/* Wide content must scroll inside itself rather than pushing the page sideways. */
.wp-block-table,
.wp-block-preformatted,
pre.wp-block-code {
	overflow-x: auto;
	max-width: 100%;
}

.wp-block-table table {
	border-collapse: collapse;
}

.wp-block-table :where(th, td) {
	border: 1px solid var(--tl-border);
	padding: 0.6rem 0.8rem;
}

.wp-block-table thead th {
	background: var(--wp--preset--color--accent-4);
	font-weight: 600;
}

/* Scores, match results and SAN inside Persian prose need bidi isolation or the
   surrounding RTL run reorders their digits. */
.tl-ltr {
	unicode-bidi: isolate;
	direction: ltr;
	display: inline-block;
}


/* ---------------------------------------------------------------------------
   Accessibility and motion
   --------------------------------------------------------------------------- */

:where(a, button, input, textarea, select, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-1);
	outline-offset: 2px;
}

.skip-link:focus {
	background: var(--wp--preset--color--accent-3);
	color: var(--wp--preset--color--contrast);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	.wp-block-post-template > li:hover,
	.wp-block-latest-posts__list > li:hover,
	.wp-block-button.tl-cta .wp-block-button__link:hover {
		transform: none;
	}
}
