/* TP-VERSION: 202610071930 */
/* ==========================================================================
   Tarot draw generator. Scoped under .tarot-draw so it cannot touch the
   light-mode site. Palette: Ink Green #1F3024, Bottle Green #3D5A45,
   Amber Glass #B8783A, Kraft Parchment #EDE6D8.
   ========================================================================== */

.tarot-draw {
	background: #1F3024;
	color: #EDE6D8;
	padding: 40px 24px;
	font-family: 'Public Sans', sans-serif;
}

.tarot-draw-inner {
	max-width: 960px;
	margin: 0 auto;
}

.tarot-draw-title {
	font-family: 'Fraunces', serif;
	font-weight: 500;
	font-size: 28px;
	color: #EDE6D8;
	margin: 0 0 8px;
	text-align: center;
}

.tarot-draw-intro {
	text-align: center;
	opacity: 0.8;
	margin: 0 0 28px;
}

/* Controls */
.tarot-draw-form {
	display: flex;
	flex-wrap: wrap;
	gap: 16px 24px;
	justify-content: center;
	align-items: center;
	margin-bottom: 20px;
}

.tarot-draw-spreads {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	border: 0;
	margin: 0;
	padding: 0;
}

.tarot-draw-spread input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.tarot-draw-spread span {
	display: inline-block;
	padding: 8px 16px;
	border: 1px solid #3D5A45;
	border-radius: 20px;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

.tarot-draw-spread input:checked + span {
	background: #3D5A45;
	border-color: #B8783A;
}

.tarot-draw-spread input:focus-visible + span,
.tarot-draw-button:focus-visible,
.tarot-draw-reveal-all:focus-visible,
.draw-flip:focus-visible,
.draw-link:focus-visible {
	outline: 2px solid #B8783A;
	outline-offset: 3px;
}

.tarot-draw-reversals {
	font-size: 14px;
	display: inline-flex;
	gap: 8px;
	align-items: center;
	cursor: pointer;
}

.tarot-draw-button,
.tarot-draw-reveal-all {
	background: #B8783A;
	color: #1F3024;
	border: 0;
	border-radius: 24px;
	padding: 10px 28px;
	font-family: inherit;
	font-weight: 500;
	font-size: 15px;
	cursor: pointer;
}

.tarot-draw-button:disabled {
	opacity: 0.6;
	cursor: wait;
}

.tarot-draw-reveal-all {
	background: transparent;
	color: #EDE6D8;
	border: 1px solid #3D5A45;
	padding: 8px 20px;
	font-size: 14px;
}

.tarot-draw-status {
	text-align: center;
	min-height: 1.5em;
	font-size: 14px;
	opacity: 0.8;
	margin-bottom: 16px;
}

.tarot-draw-actions {
	text-align: center;
	margin-top: 24px;
}

.tarot-draw-actions .tarot-draw-reveal-all + .tarot-draw-reveal-all {
	margin-left: 12px;
}

.tarot-draw-results:focus {
	outline: none;
}

/* Grid */
.draw-grid {
	display: grid;
	gap: 28px 20px;
	justify-content: center;
	grid-template-columns: repeat(auto-fit, minmax(170px, 220px));
}

.draw-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.draw-position {
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #B8783A;
	margin: 0 0 10px;
}

/* Flip */
.draw-flip {
	display: block;
	width: 100%;
	max-width: 220px;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	perspective: 900px;
}

.draw-flip-inner {
	display: block;
	position: relative;
	aspect-ratio: 2 / 3;
	transform-style: preserve-3d;
	transition: transform 0.7s ease;
}

.draw-card.is-flipped .draw-flip-inner {
	transform: rotateY(180deg);
}

.draw-face {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	border-radius: 6px;
	overflow: hidden;
}

/* Card back: Bottle Green, amber frame, a single mark */
.draw-back {
	background: #3D5A45;
	border: 1px solid #B8783A;
	box-shadow: inset 0 0 0 6px #1F3024, inset 0 0 0 7px #B8783A;
}

.draw-back::after {
	content: "✦";
	font-size: 34px;
	color: #B8783A;
}

/* Custom card back artwork (assets/img/tarot-back.png) replaces the drawn back */
.draw-back.has-art {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	border-color: #3D5A45;
	box-shadow: none;
}

.draw-back.has-art::after {
	content: none;
}

.draw-front {
	background: #1F3024;
	border: 1px solid #3D5A45;
	transform: rotateY(180deg);
}

.draw-front-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.draw-front-img.is-reversed {
	transform: rotate(180deg);
}

.draw-front-fallback {
	padding: 12px;
	font-family: 'Fraunces', serif;
}

/* Details */
.draw-details {
	margin-top: 14px;
	max-width: 220px;
}

.draw-name {
	font-family: 'Fraunces', serif;
	font-weight: 500;
	font-size: 18px;
	color: #EDE6D8;
	margin: 0 0 4px;
}

.draw-meta {
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.6;
	margin: 0 0 8px;
}

.draw-meaning {
	font-size: 14px;
	line-height: 1.6;
	margin: 0 0 8px;
}

.draw-keywords {
	font-size: 12px;
	font-style: italic;
	opacity: 0.6;
	margin: 0 0 8px;
}

.draw-link {
	color: #B8783A;
	font-size: 13px;
	text-decoration: none;
}

.draw-link:hover {
	text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
	.draw-flip-inner {
		transition: none;
	}
}

@media (max-width: 480px) {
	.tarot-draw {
		padding: 28px 16px;
	}
	.draw-grid {
		grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	}
}

/* ==========================================================================
   Pop-out card (native <dialog>). Opens over the draw so nothing is lost.
   ========================================================================== */

body.tarot-modal-open {
	overflow: hidden;
}

.draw-modal {
	background: #1F3024;
	color: #EDE6D8;
	border: 1px solid #3D5A45;
	border-radius: 8px;
	padding: 0;
	width: min(920px, calc(100vw - 32px));
	max-width: none;
	max-height: calc(100vh - 32px);
	overflow: hidden;
	text-align: left;
	font-family: 'Public Sans', sans-serif;
}

.draw-modal::backdrop {
	background: rgba(10, 18, 12, 0.84);
}

.draw-modal-body {
	position: relative;
	display: grid;
	grid-template-columns: minmax(180px, 300px) 1fr;
	gap: 28px;
	padding: 28px;
	max-height: calc(100vh - 34px);
	overflow-y: auto;
}

.draw-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 1px solid #3D5A45;
	border-radius: 50%;
	background: #1F3024;
	color: #EDE6D8;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 1;
}

.draw-modal-close:hover {
	border-color: #B8783A;
}

.draw-modal-close:focus-visible {
	outline: 2px solid #B8783A;
	outline-offset: 2px;
}

.draw-modal-art {
	align-self: start;
	position: sticky;
	top: 0;
}

.draw-modal-img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid #3D5A45;
	border-radius: 4px;
}

.draw-modal-title {
	font-family: 'Fraunces', serif;
	font-weight: 500;
	font-size: 28px;
	color: #EDE6D8;
	margin: 0 0 12px;
	padding-right: 40px;
}

.draw-modal-text .draw-meta {
	margin: 0 0 4px;
}

.draw-modal-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 18px;
}

.draw-modal-tag {
	background: #3D5A45;
	color: #EDE6D8;
	font-size: 12px;
	padding: 4px 12px;
	border-radius: 20px;
}

.draw-modal-section {
	margin: 0 0 18px;
}

.draw-modal-heading {
	font-family: 'Fraunces', serif;
	font-weight: 500;
	font-size: 15px;
	color: #EDE6D8;
	margin: 0 0 6px;
}

.draw-modal-section p {
	font-size: 14px;
	line-height: 1.7;
	margin: 0;
}

.draw-modal-section.is-secondary p {
	opacity: 0.75;
}

/* Oxblood as a wash plus stripe, never as text on Ink Green */
.draw-modal-booknote {
	border-left: 2px solid #6B2E2A;
	background: rgba(107, 46, 42, 0.18);
	padding: 12px 16px;
}

.draw-modal-herbs .is-primary {
	font-weight: 500;
}

.draw-modal-text > .draw-link {
	display: inline-block;
	margin-top: 8px;
}

@media (max-width: 640px) {
	.draw-modal {
		width: calc(100vw - 16px);
		max-height: calc(100vh - 16px);
	}
	.draw-modal-body {
		grid-template-columns: 1fr;
		gap: 18px;
		padding: 20px 16px;
		max-height: calc(100vh - 18px);
	}
	.draw-modal-art {
		position: static;
		max-width: 220px;
		margin: 28px auto 0;
	}
}

/* ==========================================================================
   Save spread (on the draw page) and My Readings (saved spreads page)
   ========================================================================== */

.tarot-draw-save {
	max-width: 560px;
	margin: 24px auto 0;
	text-align: center;
}

.tarot-draw-save-button {
	background: transparent;
	color: #EDE6D8;
	border: 1px solid #B8783A;
	border-radius: 24px;
	padding: 9px 24px;
	font-family: inherit;
	font-size: 14px;
	cursor: pointer;
}

.tarot-draw-save-button:hover {
	background: rgba(184, 120, 58, 0.15);
}

.tarot-draw-save-button:focus-visible {
	outline: 2px solid #B8783A;
	outline-offset: 3px;
}

.tarot-draw-save-note {
	font-size: 14px;
	opacity: 0.85;
	margin: 0;
}

.tarot-draw-save-form,
.reading-edit {
	text-align: left;
}

.tarot-draw-save-label {
	display: block;
	font-size: 13px;
	margin: 0 0 14px;
}

.tarot-draw-save-input {
	display: block;
	width: 100%;
	margin-top: 6px;
	padding: 10px 12px;
	background: rgba(237, 230, 216, 0.06);
	color: #EDE6D8;
	border: 1px solid #3D5A45;
	border-radius: 6px;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.6;
	box-sizing: border-box;
}

.tarot-draw-save-input:focus {
	outline: 2px solid #B8783A;
	outline-offset: 1px;
}

.tarot-draw-save-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
}

.tarot-draw-save-msg {
	font-size: 13px;
	opacity: 0.85;
}

/* My Readings */
.tarot-readings {
	background: #1F3024;
	color: #EDE6D8;
	padding: 40px 24px;
	font-family: 'Public Sans', sans-serif;
}

.tarot-readings-inner {
	max-width: 760px;
	margin: 0 auto;
}

.tarot-readings-list {
	display: grid;
	gap: 28px;
}

.reading {
	border: 1px solid #3D5A45;
	border-radius: 8px;
	padding: 24px;
}

.reading-date {
	margin: 0 0 16px;
}

.reading-cards {
	list-style: none;
	margin: 0 0 22px;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
}

.reading-card {
	width: 120px;
	text-align: center;
}

.reading-card-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.reading-card-img {
	display: block;
	width: 100%;
	aspect-ratio: 2 / 3;
	object-fit: contain;
	background: #1F3024;
	border: 1px solid #3D5A45;
	border-radius: 4px;
}

.reading-card-img.is-reversed {
	transform: rotate(180deg);
}

.reading-card-name {
	display: block;
	font-family: 'Fraunces', serif;
	font-size: 14px;
	margin-top: 8px;
}

.reading-card-locked {
	display: block;
	font-size: 13px;
	opacity: 0.6;
	padding: 40px 0;
}

.reading-card .draw-meta {
	display: block;
	margin: 2px 0 0;
}

@media (max-width: 480px) {
	.tarot-readings {
		padding: 28px 16px;
	}
	.reading {
		padding: 18px 14px;
	}
	.reading-card {
		width: calc(50% - 9px);
	}
}

/* ==========================================================================
   Five-card spread layout (tablet and desktop only; phones keep their layout).
   The old grid sized columns for 220px cards, so only four fit across and the
   fifth sat alone, left-aligned. Now: five across when there is room, otherwise
   three on top and two centered underneath.
   ========================================================================== */

@media (min-width: 641px) {
	.draw-grid.draw-grid-5 {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 28px 20px;
	}

	/* 3 + 2, each row centered */
	.draw-grid-5 .draw-card {
		flex: 0 0 calc((100% - 40px) / 3);
		max-width: 220px;
	}
}

@media (min-width: 900px) {
	/* five across */
	.draw-grid-5 .draw-card {
		flex: 0 0 calc((100% - 80px) / 5);
		max-width: none;
	}

	.draw-grid-5 .draw-meaning {
		font-size: 13px;
	}
}
