/* Tucano Popup: herda a fonte do tema para parecer parte do site */
.tp-root[hidden] { display: none !important; }

.tp-root {
	--tp-radius: 14px;
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: inherit;
	color: var(--tp-text);
}

.tp-overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 28, 24, .55);
	opacity: 0;
	transition: opacity .25s ease;
}

.tp-card {
	position: relative;
	display: grid;
	grid-template-columns: 1fr;
	width: min(100%, 460px);
	max-height: calc(100vh - 32px);
	overflow: auto;
	background: var(--tp-bg);
	border-radius: var(--tp-radius);
	border-top: 6px solid var(--tp-accent);
	box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
	transform: translateY(16px) scale(.98);
	opacity: 0;
	transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .25s ease;
}

.tp-card.tp-has-img { width: min(100%, 680px); grid-template-columns: 38% 1fr; }

.tp-root.tp-open .tp-overlay { opacity: 1; }
.tp-root.tp-open .tp-card { transform: none; opacity: 1; }

.tp-media { background: color-mix(in srgb, var(--tp-accent) 14%, var(--tp-bg)); display: flex; align-items: center; justify-content: center; }
.tp-media img { display: block; width: 100%; height: 100%; object-fit: cover; }

.tp-body { padding: 28px 28px 24px; }

.tp-title {
	margin: 0 32px 10px 0;
	font-size: 1.45rem;
	line-height: 1.2;
	font-weight: 800;
	color: var(--tp-text);
}

/* título alternativo só aparece na barra do celular */
.tp-title-bar { display: none; }
.tp-root.tp-bar .tp-title:has(.tp-title-bar) .tp-title-main { display: none; }
.tp-root.tp-bar .tp-title-bar { display: inline; }

.tp-text { font-size: 1rem; line-height: 1.55; opacity: .85; }
.tp-text p { margin: 0 0 10px; }

.tp-custom { margin: 14px 0 4px; }
.tp-custom input[type="email"],
.tp-custom input[type="text"] { width: 100%; box-sizing: border-box; }

.tp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 18px; }

.tp-btn {
	display: inline-block;
	padding: 13px 22px;
	border-radius: 10px;
	background: var(--tp-accent);
	color: var(--tp-btn-text, #fff) !important;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.2;
	text-decoration: none !important;
	border: 0;
	cursor: pointer;
	transition: filter .15s ease, transform .15s ease;
}
.tp-btn:hover { filter: brightness(.93); }
.tp-btn:active { transform: translateY(1px); }

.tp-dismiss {
	background: none;
	border: 0;
	padding: 6px 2px;
	font: inherit;
	font-size: .92rem;
	color: var(--tp-text);
	opacity: .65;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}
.tp-dismiss:hover { opacity: 1; }

.tp-x {
	position: absolute;
	top: 8px;
	right: 10px;
	z-index: 2;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--tp-text);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	opacity: .6;
}
.tp-x:hover { opacity: 1; background: rgba(0, 0, 0, .06); }

.tp-root :focus-visible { outline: 3px solid var(--tp-accent); outline-offset: 2px; }

/* Popup em telas pequenas: imagem vai para cima e diminui */
@media (max-width: 640px) {
	.tp-card.tp-has-img { grid-template-columns: 1fr; }
	.tp-media { max-height: 150px; }
	.tp-body { padding: 22px 20px 20px; }
	.tp-title { font-size: 1.25rem; }
}

/* Modo barra no rodapé (celular) */
.tp-root.tp-bar {
	inset: auto 0 0 0;
	padding: 0 0 env(safe-area-inset-bottom, 0);
	align-items: flex-end;
}
.tp-root.tp-bar .tp-overlay { display: none; }
.tp-root.tp-bar .tp-card {
	width: 100%;
	grid-template-columns: 1fr;
	border-radius: var(--tp-radius) var(--tp-radius) 0 0;
	border-top-width: 4px;
	box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
	transform: translateY(100%);
}
.tp-root.tp-bar.tp-open .tp-card { transform: none; }
.tp-root.tp-bar .tp-media,
.tp-root.tp-bar .tp-text,
.tp-root.tp-bar .tp-custom,
.tp-root.tp-bar .tp-dismiss { display: none; }
.tp-root.tp-bar .tp-body {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 48px 12px 16px;
}
.tp-root.tp-bar .tp-title { margin: 0; font-size: 1rem; flex: 1; }
.tp-root.tp-bar .tp-actions { margin: 0; flex-shrink: 0; }
.tp-root.tp-bar .tp-btn { padding: 10px 14px; font-size: .92rem; }
.tp-root.tp-bar .tp-x { top: 50%; transform: translateY(-50%); right: 6px; }

@media (prefers-reduced-motion: reduce) {
	.tp-overlay, .tp-card, .tp-btn { transition: none !important; }
}

/* =====================================================================
   Estilo "Folha de redação": linhas pautadas, margem numerada
   e a nota circulada pela caneta do corretor.
   ===================================================================== */
.tp-folha {
	--tp-row: 30px;
	--tp-line: color-mix(in srgb, var(--tp-accent) 16%, var(--tp-bg));
	--tp-gutter: 44px;
}

.tp-folha .tp-card {
	width: min(100%, 520px);
	border-top: 0;
	border-radius: 4px;
	box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 30px 70px rgba(10, 16, 40, .35);
	background: var(--tp-bg);
}
/* com imagem: a arte fica em cima, a folha pautada embaixo */
.tp-folha .tp-card.tp-has-img { width: min(100%, 500px); grid-template-columns: 1fr; }
.tp-folha .tp-has-img .tp-media { border-right: 0; aspect-ratio: 3 / 2; }
.tp-folha .tp-has-img .tp-title { margin-right: 24px; font-size: 1.4rem; }

.tp-folha .tp-body {
	position: relative;
	padding: var(--tp-row) 28px var(--tp-row) calc(var(--tp-gutter) + 20px);
	background: repeating-linear-gradient(to bottom, transparent 0 calc(var(--tp-row) - 1px), var(--tp-line) calc(var(--tp-row) - 1px) var(--tp-row)) 0 var(--tp-row) / 100% calc(100% - var(--tp-row) * 2) no-repeat;
}

/* margem com números de linha, como a folha oficial */
.tp-folha .tp-body::before {
	content: "1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9\A 10\A 11\A 12\A 13\A 14\A 15\A 16\A 17\A 18\A 19\A 20\A 21\A 22\A 23\A 24\A 25\A 26\A 27\A 28\A 29\A 30";
	white-space: pre;
	position: absolute;
	top: var(--tp-row);
	bottom: 0;
	left: 0;
	width: var(--tp-gutter);
	overflow: hidden;
	padding-right: 10px;
	box-sizing: border-box;
	text-align: right;
	font-size: 11px;
	line-height: var(--tp-row);
	font-variant-numeric: tabular-nums;
	color: color-mix(in srgb, var(--tp-text) 40%, var(--tp-bg));
	border-right: 1px solid color-mix(in srgb, var(--tp-mark) 45%, var(--tp-bg));
}

.tp-folha .tp-title {
	margin: 0 118px var(--tp-row) 0;
	font-size: 1.6rem;
	line-height: var(--tp-row);
	font-weight: 800;
	letter-spacing: -.01em;
	color: var(--tp-text);
}
.tp-folha .tp-text { opacity: 1; font-size: 1rem; line-height: var(--tp-row); color: color-mix(in srgb, var(--tp-text) 82%, var(--tp-bg)); }
.tp-folha .tp-text p { margin: 0 0 var(--tp-row); }
.tp-folha .tp-text p:last-child { margin-bottom: 0; }

.tp-folha .tp-actions { margin-top: var(--tp-row); gap: 12px 22px; }

.tp-folha .tp-btn {
	border-radius: 3px;
	padding: 14px 24px;
	font-size: 1.02rem;
	box-shadow: 3px 3px 0 var(--tp-text);
	transition: transform .15s ease, box-shadow .15s ease;
}
.tp-folha .tp-btn:hover { filter: none; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--tp-text); }
.tp-folha .tp-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--tp-text); }

.tp-folha .tp-dismiss { color: var(--tp-text); }

/* a nota do corretor */
.tp-mark {
	position: absolute;
	top: 22px;
	right: 50px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 92px;
	height: 64px;
	padding: 0 10px;
	box-sizing: border-box;
	font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive;
	font-weight: 700;
	font-size: 42px;
	line-height: 1;
	color: var(--tp-mark);
	border: 3px solid var(--tp-mark);
	border-radius: 52% 48% 55% 45% / 50% 58% 42% 50%;
	transform: rotate(-9deg);
	pointer-events: none;
}
.tp-folha.tp-open .tp-mark { animation: tp-stamp .45s .25s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes tp-stamp {
	from { opacity: 0; transform: rotate(-9deg) scale(1.6); }
	to   { opacity: 1; transform: rotate(-9deg) scale(1); }
}

.tp-folha .tp-x { top: 6px; right: 6px; }
.tp-folha .tp-media { border-right: 1px solid var(--tp-line); }

@media (max-width: 640px) {
	.tp-folha { --tp-gutter: 30px; --tp-row: 28px; }
	.tp-folha .tp-body { padding: var(--tp-row) 18px var(--tp-row) calc(var(--tp-gutter) + 12px); }
	.tp-folha .tp-title { font-size: 1.3rem; margin-right: 76px; }
	.tp-folha .tp-has-img .tp-title { font-size: 1.2rem; margin-right: 8px; }
	.tp-folha .tp-has-img .tp-media { max-height: none; }
	.tp-mark { top: 18px; right: 40px; min-width: 70px; height: 50px; font-size: 32px; }
}

/* barra do celular no estilo folha */
.tp-folha.tp-bar .tp-card {
	border-radius: 0;
	border-top: 1px solid var(--tp-line);
	background: var(--tp-bg);
	box-shadow: 0 -10px 30px rgba(10, 16, 40, .18);
}
.tp-folha.tp-bar .tp-body { padding: 10px 44px 10px 12px; }
.tp-folha.tp-bar .tp-body::before { display: none; }
.tp-folha.tp-bar .tp-title { margin: 0; font-size: .98rem; line-height: 1.25; font-weight: 700; }
.tp-folha.tp-bar .tp-mark {
	position: static;
	flex-shrink: 0;
	min-width: 56px;
	height: 38px;
	font-size: 25px;
	border-width: 2px;
	animation: none;
}
.tp-folha.tp-bar .tp-btn { padding: 10px 12px; font-size: .9rem; box-shadow: 2px 2px 0 var(--tp-text); }

@media (prefers-reduced-motion: reduce) {
	.tp-folha.tp-open .tp-mark { animation: none; }
}

/* ícone (tucano) na barra do celular */
.tp-bar-icon { display: none; }
.tp-root.tp-bar .tp-bar-icon {
	display: block;
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--tp-accent);
}
.tp-root.tp-bar .tp-has-icon .tp-mark { display: none; }
.tp-folha .tp-media img { width: 100%; height: 100%; object-fit: cover; }

/* =====================================================================
   Painel do celular: sobe do rodapé com título, texto e botão,
   deixando o topo do artigo visível.
   ===================================================================== */
.tp-handle, .tp-text-mobile { display: none; }

.tp-root.tp-sheet {
	inset: auto 0 0 0;
	padding: 0;
	align-items: flex-end;
}
.tp-root.tp-sheet .tp-overlay { display: none; }
.tp-root.tp-sheet .tp-card {
	width: 100%;
	max-height: 62vh;
	grid-template-columns: 1fr;
	border-radius: 18px 18px 0 0;
	border-top: 0;
	box-shadow: 0 -12px 40px rgba(10, 20, 60, .28);
	transform: translateY(100%);
	opacity: 1;
	padding-bottom: env(safe-area-inset-bottom, 0);
}
.tp-root.tp-sheet.tp-open .tp-card { transform: none; }

.tp-root.tp-sheet .tp-handle {
	display: block;
	width: 40px;
	height: 4px;
	margin: 8px auto 0;
	border-radius: 2px;
	background: color-mix(in srgb, var(--tp-text) 25%, var(--tp-bg));
}
.tp-root.tp-sheet .tp-media,
.tp-root.tp-sheet .tp-mark,
.tp-root.tp-sheet .tp-custom { display: none; }
.tp-root.tp-sheet .tp-has-mtext .tp-text { display: none; }
.tp-root.tp-sheet .tp-has-mtext .tp-text-mobile { display: block; }

.tp-root.tp-sheet .tp-body { padding: 14px 20px 20px; }
.tp-folha.tp-sheet { --tp-row: 26px; }
.tp-folha.tp-sheet .tp-body {
	padding: 12px 20px 20px 20px;
	background: repeating-linear-gradient(to bottom, transparent 0 calc(var(--tp-row) - 1px), var(--tp-line) calc(var(--tp-row) - 1px) var(--tp-row)) 0 12px / 100% calc(100% - 32px) no-repeat;
	border-left: 3px solid color-mix(in srgb, var(--tp-mark) 45%, var(--tp-bg));
}
.tp-folha.tp-sheet .tp-body::before { display: none; }

.tp-root.tp-sheet .tp-bar-icon {
	display: block;
	float: left;
	width: 52px;
	height: 52px;
	margin: 0 12px 0 0;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--tp-accent);
	box-sizing: border-box;
}
.tp-root.tp-sheet .tp-title {
	margin: 0 28px var(--tp-row, 12px) 0;
	font-size: 1.12rem;
	line-height: var(--tp-row, 1.3);
	font-weight: 800;
}
.tp-root.tp-sheet .tp-text-mobile,
.tp-root.tp-sheet .tp-text {
	clear: both;
	font-size: .95rem;
	line-height: var(--tp-row, 1.5);
	color: color-mix(in srgb, var(--tp-text) 85%, var(--tp-bg));
}
.tp-root.tp-sheet .tp-text-mobile p,
.tp-root.tp-sheet .tp-text p { margin: 0; }

.tp-root.tp-sheet .tp-actions {
	clear: both;
	margin-top: var(--tp-row, 16px);
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
}
.tp-root.tp-sheet .tp-btn { text-align: center; padding: 15px 18px; font-size: 1.02rem; }
.tp-root.tp-sheet .tp-dismiss { align-self: center; }
.tp-root.tp-sheet .tp-x { top: 10px; right: 8px; }

@media (prefers-reduced-motion: reduce) {
	.tp-root.tp-sheet .tp-card { transition: none; }
}
