/*
Theme Name: Noor Tales Studio
Theme URI: https://github.com/santhanag-netizen/noor-tales-studio-theme
Author: Noor Tales Studio
Description: A warm, calm, child-friendly block theme for Noor Tales Studio — Islamic children's books, story videos and bedtime stories. Built for the WordPress Site Editor (Full Site Editing): every template, part and pattern can be edited without code or a page builder.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 0.3.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: noor-tales
Tags: block-theme, full-site-editing, custom-colors, custom-logo, editor-style, wide-blocks, block-patterns, accessibility-ready, one-column, education
*/

/*
 * Most styling lives in theme.json so it stays editable in
 * Appearance > Editor > Styles. This file only holds the few rules
 * theme.json cannot express yet (focus states, card hover, helpers).
 */

/* Visible, high-contrast keyboard focus for every interactive element. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--secondary);
	outline-offset: 3px;
	box-shadow: 0 0 0 6px var(--wp--preset--color--contrast);
	border-radius: 4px;
}

.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Cards used by the book and video grids. */
.is-style-noor-card {
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.is-style-noor-card:hover,
.is-style-noor-card:focus-within {
	transform: translateY(-3px);
	box-shadow: var(--wp--preset--shadow--lifted);
}

/* Book covers keep their 3:4 shape; "contain" never crops the artwork. */
.noor-book-cover img {
	aspect-ratio: 3 / 4;
	object-fit: contain;
	width: 100%;
	height: auto;
}

/* Video thumbnails keep a 16:9 shape. */
.noor-video-thumb img {
	aspect-ratio: 16 / 9;
	object-fit: cover;
	width: 100%;
	height: auto;
}

/* Bullet-free link lists (footer). */
.noor-plain-list {
	list-style: none;
}

/* "Placeholder" badge so draft content is never mistaken for real content. */
.noor-placeholder-note {
	border: 2px dashed currentColor;
	border-radius: 12px;
	padding: 0.75rem 1rem;
}

/* Links inside body copy get an underline for clarity (not colour alone). */
.wp-block-post-content a:where(:not(.wp-element-button)) {
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

/* Equal-height cards in grids, with buttons aligned at the bottom. */
.wp-block-post-template.is-layout-grid > li {
	display: flex;
}

.wp-block-post-template.is-layout-grid > li > .wp-block-group {
	flex: 1;
}

/* Compact buttons inside book cards so "Buy on Amazon" fits on one line. */
.is-style-noor-card .wp-block-button__link {
	padding: 0.6em 0.9em;
	white-space: nowrap;
}

/* Header: a quiet brand line under the site header. */
header.wp-block-template-part {
	border-bottom: 3px solid var(--wp--preset--color--light-green);
}

/* Hero text stays readable over any banner photo. */
.wp-block-cover .wp-block-heading,
.wp-block-cover p {
	text-shadow: 0 1px 12px rgba(15, 58, 42, 0.45);
}

/* ---------- Book quiz ---------- */
.noor-quiz {
	margin-top: var(--wp--preset--spacing--60);
	padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
	background: var(--wp--preset--color--base-2);
	border-top: 6px solid var(--wp--preset--color--secondary);
	border-radius: var(--wp--custom--radius--large);
}

.noor-quiz__score {
	font-weight: 800;
	color: var(--wp--preset--color--primary);
}

.noor-quiz__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--wp--preset--spacing--40);
}

.noor-quiz__question {
	background: var(--wp--preset--color--base);
	border-radius: var(--wp--custom--radius--medium);
	padding: var(--wp--preset--spacing--40);
	box-shadow: var(--wp--preset--shadow--soft);
}

.noor-quiz fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.noor-quiz legend {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	color: var(--wp--preset--color--primary);
	margin-bottom: var(--wp--preset--spacing--30);
	padding: 0;
}

.noor-quiz__options {
	display: grid;
	gap: 0.6rem;
}

@media (min-width: 700px) {
	.noor-quiz__options {
		grid-template-columns: 1fr 1fr;
	}
}

.noor-quiz__option {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-height: 48px;
	padding: 0.6rem 0.9rem;
	border: 2px solid var(--wp--preset--color--light-green);
	border-radius: var(--wp--custom--radius--small);
	background: var(--wp--preset--color--base);
	cursor: pointer;
}

.noor-quiz__option:hover,
.noor-quiz__option:has(input:checked) {
	border-color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--primary-soft);
}

.noor-quiz__option:focus-within {
	outline: 3px solid var(--wp--preset--color--secondary);
	outline-offset: 2px;
}

.noor-quiz__option input {
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
	accent-color: var(--wp--preset--color--primary);
	flex: none;
}

.noor-quiz__letter {
	font-weight: 800;
	color: var(--wp--preset--color--primary);
}

.noor-quiz__option.is-right-answer {
	border-color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--primary-soft);
}

.noor-quiz__option.is-right-answer .noor-quiz__text::after {
	content: " ✓";
	font-weight: 800;
}

/* After checking, only the right answer is highlighted. */
.is-answered .noor-quiz__option.is-wrong-choice {
	border-style: dashed;
	border-color: var(--wp--preset--color--muted);
	background: var(--wp--preset--color--base);
}

.is-answered .noor-quiz__option {
	cursor: default;
}

/* Buttons only make sense once the script is running. */
.noor-quiz:not(.noor-quiz--ready) .noor-quiz__check {
	display: none;
}

.noor-quiz__check,
.noor-quiz__retry {
	margin-top: var(--wp--preset--spacing--30);
}

.noor-quiz__check[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

.noor-quiz__feedback:not(:empty) {
	margin-top: var(--wp--preset--spacing--30);
	padding: 0.75rem 1rem;
	border-left: 5px solid var(--wp--preset--color--secondary);
	border-radius: var(--wp--custom--radius--small);
	background: var(--wp--preset--color--base-2);
}

.is-correct .noor-quiz__feedback {
	border-left-color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--primary-soft);
}

.noor-quiz__verdict {
	font-weight: 800;
	margin: 0 0 0.25rem;
}

.noor-quiz__explanation {
	margin: 0;
}

.noor-quiz__result {
	margin-top: var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--40);
	text-align: center;
	background: var(--wp--preset--color--night);
	color: var(--wp--preset--color--night-text);
	border-radius: var(--wp--custom--radius--medium);
}

.noor-quiz__result-title {
	color: var(--wp--preset--color--night-text);
	margin-top: 0;
}

.noor-quiz__retry {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--contrast);
}
