/* The Steady Hearts – message cards. Everything is scoped to .tsh-app so it won't touch the rest of the site. */

.tsh-app {
	--tsh-ink: #2E3226;
	--tsh-muted: #6F6A5B;
	--tsh-paper: #FBF7EF;
	--tsh-line: rgba(46, 50, 38, 0.16);
	--tsh-bg2: #EFE6D8;
	--tsh-cream: #FFFDF8;
	--tsh-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
	--tsh-sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
	--tsh-shadow: 0 22px 46px rgba(78, 62, 40, 0.22);
	box-sizing: border-box;
	width: 100%;
	max-width: 1120px;
	margin: 0 auto;
	padding: 4px 0 40px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	color: var(--tsh-ink);
	font-family: var(--tsh-sans);
}
.tsh-app *, .tsh-app *::before, .tsh-app *::after { box-sizing: border-box; }
.tsh-app [hidden] { display: none !important; }

/* Top banner */
.tsh-app .tsh-hero {
	width: 100%;
	min-height: 210px;
	border-radius: 20px;
	overflow: hidden;
	position: relative;
	background-size: cover;
	background-position: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 28px 20px;
}
.tsh-app .tsh-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(75% 70% at 50% 50%, rgba(251, 244, 232, 0.86), rgba(251, 244, 232, 0.55) 60%, rgba(251, 244, 232, 0.1));
}
.tsh-app .tsh-hero > * { position: relative; }
.tsh-app .tsh-hero-title {
	font-family: var(--tsh-serif);
	font-weight: 500;
	font-size: 2rem;
	line-height: 1.12;
	margin: 0;
	color: var(--tsh-ink);
	max-width: 16ch;
}
.tsh-app .tsh-hero .tsh-hl { width: 150px; height: 22px; margin-top: 8px; }

.tsh-app .tsh-prompt { margin: 0; color: var(--tsh-muted); text-align: center; font-size: 1rem; }

/* Category buttons (extra-specific so the theme's button styles don't win) */
.tsh-app .tsh-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: -6px 0 0; }
.tsh-app button.tsh-chip,
.tsh-app button.tsh-chip:hover,
.tsh-app button.tsh-chip:focus {
	font-family: var(--tsh-sans);
	font-size: 0.92rem;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	border: 1px solid var(--tsh-line);
	border-radius: 999px;
	padding: 8px 15px;
	min-height: 0;
	background: transparent;
	color: var(--tsh-ink);
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.tsh-app button.tsh-chip:hover { border-color: var(--tsh-accent); }
.tsh-app button.tsh-chip[aria-pressed="true"] {
	background: var(--tsh-accent);
	border-color: var(--tsh-accent);
	color: var(--tsh-cream);
}

/* The card */
.tsh-app .tsh-stage { perspective: 1300px; width: 100%; display: flex; justify-content: center; padding: 4px 0; }
.tsh-app button.tsh-card,
.tsh-app button.tsh-card:hover,
.tsh-app button.tsh-card:focus {
	position: relative;
	display: block;
	width: min(300px, 80vw);
	aspect-ratio: 5 / 7;
	height: auto;
	border: 0;
	padding: 0;
	margin: 0;
	background: none;
	box-shadow: none;
	border-radius: 16px;
	cursor: pointer;
	color: inherit;
	font-family: var(--tsh-sans);
	font-weight: 400;
	line-height: 1.3;
	text-transform: none;
	letter-spacing: normal;
	white-space: normal;
	transform-style: preserve-3d;
	transition: transform 0.8s cubic-bezier(.2, .8, .2, 1);
}
.tsh-app button.tsh-card.is-flipped { transform: rotateY(180deg); cursor: default; }
.tsh-app .tsh-face {
	position: absolute;
	inset: 0;
	border-radius: 16px;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	box-shadow: var(--tsh-shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}
.tsh-app .tsh-back {
	background: linear-gradient(180deg, var(--tsh-tint), rgba(0, 0, 0, 0) 45%, rgba(30, 26, 18, 0.55)), var(--tsh-img) var(--tsh-pos) / cover no-repeat;
	color: var(--tsh-cream);
	justify-content: flex-end;
	padding: 26px 22px 30px;
}
.tsh-app .tsh-back::after,
.tsh-app .tsh-front::after {
	content: "";
	position: absolute;
	inset: 10px;
	border-radius: 10px;
	pointer-events: none;
}
.tsh-app .tsh-back::after { border: 1px solid rgba(255, 253, 248, 0.55); }
.tsh-app .tsh-back .tsh-hl { width: 110px; height: 18px; margin-bottom: 8px; }
.tsh-app .tsh-line {
	font-family: var(--tsh-serif);
	font-weight: 500;
	font-size: 1.6rem;
	line-height: 1.2;
	text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
}
.tsh-app .tsh-tap { margin-top: 10px; font-size: 0.86rem; letter-spacing: 0.08em; opacity: 0.92; }

.tsh-app .tsh-front {
	transform: rotateY(180deg);
	color: var(--tsh-ink);
	justify-content: center;
	padding: 34px 28px 50px;
	background-color: var(--tsh-paper);
	background-image:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .28 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
		radial-gradient(130% 90% at 50% 0%, #FFFDF8, var(--tsh-paper) 55%, #F1E8D8);
}
.tsh-app .tsh-front::after { border: 1px solid rgba(139, 142, 107, 0.45); }
.tsh-app .tsh-sprig { position: absolute; left: 14px; bottom: 12px; width: 62px; height: 90px; opacity: 0.85; }
.tsh-app .tsh-sprig-r { left: auto; right: 14px; top: 14px; bottom: auto; transform: scale(-1, -1); width: 44px; height: 64px; opacity: 0.55; }
.tsh-app .tsh-msg {
	display: block;
	font-family: var(--tsh-serif);
	font-weight: 500;
	font-size: 1.55rem;
	line-height: 1.35;
	margin: 0;
	position: relative;
}
.tsh-app .tsh-front .tsh-hl { width: 96px; height: 16px; margin-top: 16px; position: relative; }
.tsh-app .tsh-sig {
	position: absolute;
	bottom: 22px;
	left: 0;
	right: 0;
	font-family: var(--tsh-serif);
	font-style: italic;
	font-size: 0.95rem;
	color: var(--tsh-muted);
}

/* Buttons under the card */
.tsh-app .tsh-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 46px; }
.tsh-app button.tsh-btn,
.tsh-app button.tsh-btn:hover,
.tsh-app button.tsh-btn:focus {
	font-family: var(--tsh-sans);
	font-weight: 500;
	font-size: 0.95rem;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	border-radius: 999px;
	padding: 11px 18px;
	min-height: 0;
	cursor: pointer;
	border: 1px solid var(--tsh-ink);
	background: transparent;
	color: var(--tsh-ink);
	box-shadow: none;
}
.tsh-app button.tsh-btn.tsh-primary,
.tsh-app button.tsh-btn.tsh-primary:hover,
.tsh-app button.tsh-btn.tsh-primary:focus { background: var(--tsh-ink); color: #F5F0E7; }
.tsh-app button.tsh-btn:hover { opacity: 0.85; }
.tsh-app .tsh-status { min-height: 1.2em; font-size: 0.9rem; color: var(--tsh-muted); margin: -8px 0 0; text-align: center; }


/* Share buttons for computers */
.tsh-app .tsh-sharebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: -8px; }
.tsh-app .tsh-sharelabel { font-size: 0.88rem; color: var(--tsh-muted); }
.tsh-app .tsh-btn.tsh-small,
.tsh-app a.tsh-btn.tsh-small,
.tsh-app button.tsh-btn.tsh-small { font-family: var(--tsh-sans); font-size: 0.86rem; font-weight: 500; line-height: 1.2; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--tsh-line); background: transparent; color: var(--tsh-ink); text-decoration: none; box-shadow: none; cursor: pointer; display: inline-block; }
.tsh-app .tsh-btn.tsh-small:hover { border-color: var(--tsh-accent); color: var(--tsh-ink); opacity: 1; }

/* "Words to share" – related blog posts */
.tsh-app .tsh-reads { width: 100%; }
.tsh-app .tsh-reads:empty { display: none; }
.tsh-app .tsh-reads h2 { font-family: var(--tsh-serif); font-weight: 600; font-size: 1.5rem; margin: 0 0 12px; color: var(--tsh-ink); }
.tsh-app .tsh-postlink {
	display: flex;
	gap: 14px;
	align-items: center;
	text-decoration: none;
	color: var(--tsh-ink);
	border: 1px solid var(--tsh-line);
	border-radius: 16px;
	padding: 10px;
	margin-bottom: 10px;
	background: var(--tsh-bg2);
}
.tsh-app .tsh-postlink:hover { border-color: var(--tsh-accent); color: var(--tsh-ink); }
.tsh-app .tsh-th { width: 64px; height: 64px; border-radius: 10px; flex: none; background-size: cover; background-position: center; }
.tsh-app .tsh-pt { font-family: var(--tsh-serif); font-weight: 600; font-size: 1.15rem; line-height: 1.25; display: block; }
.tsh-app .tsh-pm { font-size: 0.84rem; color: var(--tsh-muted); display: block; margin-top: 3px; }

.tsh-app button:focus-visible, .tsh-app a:focus-visible { outline: 2px solid var(--tsh-accent); outline-offset: 3px; }

/* Desktop layout: card on the left, choices on the right */
@media (min-width: 900px) {
	.tsh-app {
		display: grid;
		grid-template-columns: 1fr 1fr;
		column-gap: 56px;
		row-gap: 18px;
		align-items: start;
		grid-template-areas:
			"hero hero"
			"stage prompt"
			"stage chips"
			"stage actions"
			"stage sharebar"
			"stage status"
			"reads reads";
		grid-template-rows: auto auto auto auto auto 1fr auto;
	}
	.tsh-app .tsh-hero { grid-area: hero; min-height: 340px; border-radius: 26px; }
	.tsh-app .tsh-hero-title { font-size: 3.1rem; max-width: 14ch; }
	.tsh-app .tsh-hero .tsh-hl { width: 220px; height: 30px; }
	.tsh-app .tsh-stage { grid-area: stage; justify-content: flex-end; padding: 12px 0; }
	.tsh-app button.tsh-card, .tsh-app button.tsh-card:hover, .tsh-app button.tsh-card:focus { width: 360px; }
	.tsh-app .tsh-msg { font-size: 1.8rem; }
	.tsh-app .tsh-line { font-size: 1.85rem; }
	.tsh-app .tsh-prompt {
		grid-area: prompt;
		text-align: left;
		font-family: var(--tsh-serif);
		font-size: 2rem;
		line-height: 1.2;
		color: var(--tsh-ink);
		margin-top: 24px;
		max-width: 16ch;
	}
	.tsh-app .tsh-chips { grid-area: chips; justify-content: flex-start; margin: 0; max-width: 420px; }
	.tsh-app .tsh-actions { grid-area: actions; justify-content: flex-start; }
	.tsh-app .tsh-status { grid-area: status; text-align: left; margin: 0; }
	.tsh-app .tsh-sharebar { grid-area: sharebar; justify-content: flex-start; margin: 0; }
	.tsh-app .tsh-reads { grid-area: reads; margin-top: 18px; }
	.tsh-app .tsh-readlist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
	.tsh-app .tsh-postlink { flex-direction: column; align-items: stretch; margin: 0; padding: 0; overflow: hidden; }
	.tsh-app .tsh-postlink .tsh-th { width: 100%; height: 170px; border-radius: 0; }
	.tsh-app .tsh-postlink .tsh-pbody { padding: 12px 16px 16px; }
	.tsh-app .tsh-pt { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
	.tsh-app button.tsh-card { transition: none; }
}
