/**
 * Asher Tripoli Fiction Engine — front-end component styles.
 *
 * Every selector is scoped under .atfe- — no bare element selectors
 * (body, a, h1, button, etc.) are restyled globally. Typography
 * (font-family, base sizing) is intentionally left to the active theme.
 */

/* ---------------------------------------------------------------------
 * Grids
 * ------------------------------------------------------------------ */

.atfe-grid {
	display: grid;
	gap: 1.5rem;
	margin: 1.5rem 0;
}

.atfe-grid--1 { grid-template-columns: 1fr; }
.atfe-grid--2 { grid-template-columns: repeat(2, 1fr); }
.atfe-grid--3 { grid-template-columns: repeat(3, 1fr); }
.atfe-grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 782px) {
	.atfe-grid--2,
	.atfe-grid--3,
	.atfe-grid--4 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.atfe-grid--2,
	.atfe-grid--3,
	.atfe-grid--4 {
		grid-template-columns: 1fr;
	}
}

/* ---------------------------------------------------------------------
 * Cards
 * ------------------------------------------------------------------ */

.atfe-card {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: var(--atfe-text);
	background: var(--atfe-surface);
	border: 1px solid var(--atfe-border);
	border-radius: 6px;
	overflow: hidden;
	transition: box-shadow 0.2s ease;
}

.atfe-card:hover,
.atfe-card:focus {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.atfe-card-image img {
	display: block;
	width: 100%;
	height: auto;
}

.atfe-card-image--round img {
	border-radius: 50%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.atfe-card-body {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	padding: 1rem;
}

.atfe-card-title {
	font-weight: 600;
	color: var(--atfe-primary);
}

.atfe-card-subtitle,
.atfe-card-meta {
	font-size: 0.9em;
	opacity: 0.75;
}

.atfe-card-excerpt {
	font-size: 0.95em;
}

/* ---------------------------------------------------------------------
 * Badges
 * ------------------------------------------------------------------ */

.atfe-badge {
	display: inline-block;
	padding: 0.2em 0.7em;
	border-radius: 999px;
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	background: var(--atfe-surface);
	color: var(--atfe-primary);
	border: 1.5px solid var(--atfe-border);
}

.atfe-badge--coming_soon {
	background: var(--atfe-primary);
	color: #fff;
	border-color: var(--atfe-primary);
}

.atfe-badge--pre_order {
	background: var(--atfe-surface);
	color: var(--atfe-primary);
	border-color: var(--atfe-accent);
}

/* ---------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------ */

.atfe-button {
	display: inline-block;
	padding: 0.6em 1.4em;
	margin: 0.25em 0.4em 0.25em 0;
	background: var(--atfe-primary);
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	border: 1px solid var(--atfe-primary);
	font-weight: 600;
	transition: opacity 0.2s ease;
}

.atfe-button:hover,
.atfe-button:focus {
	opacity: 0.88;
	color: #fff;
}

.atfe-retailer-buttons {
	margin: 1em 0;
}

.atfe-button--secondary {
	background: transparent;
	color: var(--atfe-primary);
}

.atfe-button--secondary:hover,
.atfe-button--secondary:focus {
	background: var(--atfe-surface);
	color: var(--atfe-primary);
}

/* ---------------------------------------------------------------------
 * Reader Gifts List
 * ------------------------------------------------------------------ */

.atfe-reader-gifts-list {
	list-style: none;
	margin: 1.5rem 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.atfe-reader-gift {
	display: flex;
	gap: 0.8em;
	align-items: flex-start;
	padding: 1em 1.2em;
	background: var(--atfe-surface);
	border: 1px solid var(--atfe-border);
	border-radius: 6px;
}

.atfe-reader-gift-icon {
	font-size: 1.6em;
	line-height: 1;
}

.atfe-reader-gift-body {
	display: flex;
	flex-direction: column;
	gap: 0.3em;
}

.atfe-reader-gift-label {
	font-weight: 600;
	color: var(--atfe-primary);
}

.atfe-reader-gift-description {
	font-size: 0.92em;
	opacity: 0.8;
}

.atfe-reader-gift-downloads {
	margin-top: 0.4em;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
}

.atfe-reader-gifts--teaser .atfe-reader-gift {
	opacity: 0.92;
}

/* ---------------------------------------------------------------------
 * Featured Book / Featured Character / Featured Location
 * ------------------------------------------------------------------ */

.atfe-featured-book {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	align-items: flex-start;
	margin: 1.5rem 0;
}

.atfe-featured-book-cover {
	flex: 0 0 260px;
	max-width: 100%;
}

.atfe-featured-book-cover img {
	width: 100%;
	height: auto;
	border-radius: 4px;
}

.atfe-featured-book-body {
	flex: 1 1 320px;
}

.atfe-featured-book-title a {
	color: var(--atfe-primary);
	text-decoration: none;
}

.atfe-featured-book-subtitle {
	opacity: 0.8;
	font-style: italic;
}

.atfe-featured-character,
.atfe-featured-location {
	max-width: 420px;
}

/* ---------------------------------------------------------------------
 * Series overview
 * ------------------------------------------------------------------ */

.atfe-series-overview {
	margin: 1.5rem 0;
}

.atfe-series-hero img {
	width: 100%;
	height: auto;
	border-radius: 6px;
	margin-bottom: 1rem;
}

.atfe-series-title {
	color: var(--atfe-primary);
	margin-bottom: 0.2em;
}

.atfe-series-tagline {
	font-style: italic;
	opacity: 0.85;
}

/* ---------------------------------------------------------------------
 * Related sections / Reading Order
 * ------------------------------------------------------------------ */

.atfe-related {
	margin: 2rem 0;
}

.atfe-related-heading {
	color: var(--atfe-primary);
	border-bottom: 1px solid var(--atfe-border);
	padding-bottom: 0.4em;
	margin-bottom: 1em;
}

.atfe-reading-order-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--atfe-border);
	border-radius: 6px;
	overflow: hidden;
}

.atfe-reading-order-item {
	display: flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.8em 1em;
	border-bottom: 1px solid var(--atfe-border);
	background: var(--atfe-surface);
}

.atfe-reading-order-item:last-child {
	border-bottom: none;
}

.atfe-reading-order-item--current {
	background: color-mix(in srgb, var(--atfe-accent) 15%, var(--atfe-surface));
	font-weight: 600;
}

.atfe-reading-order-item a {
	color: var(--atfe-primary);
	text-decoration: none;
	display: inline-flex;
	gap: 0.4em;
}

.atfe-reading-order-number {
	opacity: 0.6;
}

.atfe-reading-order-current-label {
	font-size: 0.85em;
	opacity: 0.7;
}

/* ---------------------------------------------------------------------
 * Newsletter CTA
 * ------------------------------------------------------------------ */

.atfe-newsletter-cta {
	margin: 2rem 0;
	padding: 1.5rem;
	background: var(--atfe-surface);
	border: 1px solid var(--atfe-border);
	border-radius: 6px;
}

.atfe-newsletter-magnet {
	margin-top: 0;
}

/* ---------------------------------------------------------------------
 * Single templates
 * ------------------------------------------------------------------ */

.atfe-book-header,
.atfe-character-header,
.atfe-location-header {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	margin-bottom: 2rem;
}

.atfe-book-cover img,
.atfe-character-portrait img,
.atfe-location-hero img {
	width: 100%;
	max-width: 320px;
	height: auto;
	border-radius: 6px;
}

.atfe-character-portrait img {
	border-radius: 50%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	max-width: 220px;
}

.atfe-spoiler summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--atfe-primary);
	padding: 0.6em 0;
}

.atfe-archive-header {
	margin-bottom: 1.5rem;
}
