/**
 * Tábua de Maré — componente clássico do wavescheck.
 * Isolado sob .wf-tide, sem colidir com o widget "Maré" existente (.wf-tide-*
 * do outro componente vive em today.css/tempo.css).
 */

.wf-tide {
	--wf-tide-ink:    #005fa3;
	--wf-tide-day:    #5facec;
	--wf-tide-grid:   #bbdcf7;
	--wf-tide-red:    #e8112d;
	--wf-tide-radius: 8px;
	--wf-tide-height: 220px;

	width: 100%;
	font-family: inherit;
	color: #1a1e2a;
	box-sizing: border-box;
	overflow: hidden;
}

/* ---- cabeçalho ---- */

.wf-tide__header {
	display: flex;
	align-items: flex-end;
	border-bottom: 2px solid var(--wf-tide-red);
	margin-bottom: 14px;
}

.wf-tide__header-label {
	background: var(--wf-tide-red);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1;
	padding: 9px 14px;
	border-radius: var(--wf-tide-radius) var(--wf-tide-radius) 0 0;
}

/* ---- área do gráfico ---- */

.wf-tide__scroll {
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;               /* barra cinza nativa escondida — usamos a barra de tempo externa */
	border-radius: var(--wf-tide-radius);
}
.wf-tide__scroll::-webkit-scrollbar { display: none; }

/* Linha flex: série à esquerda, coluna do paywall à direita. Os flex-grow
   (dias vs 1) fazem a coluna do CTA medir exatamente um dia em qualquer
   largura de tela — mesmo arranjo do gráfico de Águas Rasas. */
.wf-tide__plot {
	position: relative;
	display: flex;
	align-items: stretch;
}

.wf-tide__series {
	flex-basis: 0;
	min-width: 0;
}

.wf-tide__gatecol {
	flex-basis: 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	border-left: 1px solid var(--wf-tide-grid);
}

/* Seletor com a coluna junto DE PROPÓSITO: a regra base `.wf-tide__day` aparece
   depois neste arquivo e, com a mesma especificidade, vencia a cascata — a
   célula bloqueada voltava a `position: absolute` com 100% da largura do plot,
   estourando a área rolável e deixando um vão em branco no fim do scroll. */
.wf-tide__gatecol .wf-tide__day--locked {
	position: static;
	width: 100%;
	opacity: 0.75;
	border-left: 0;
}

.wf-tide__gatecard {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	overflow: hidden;
}

/* Continuação real da curva, desfocada, por baixo do card do CTA. */
.wf-tide__gateblur {
	position: absolute;
	inset: 0;
	filter: blur(3px);
	opacity: 0.55;
	pointer-events: none;
	transform: scale(1.06);
	transform-origin: center;
}

.wf-tide__gateblur .wf-tide__svg--gate {
	width: 100%;
	height: 100%;
	cursor: default;
}

/* O card do gate é compartilhado; aqui precisa caber numa coluna estreita. */
.wf-tide__gatecard .wf-gate { position: static; width: 100%; height: auto; background: none; backdrop-filter: none; }
.wf-tide__gatecard .wf-gate__teaser { display: none; }
.wf-tide__gatecard .wf-gate__card { width: 100%; max-width: 100%; padding: 10px 8px; gap: 6px; box-sizing: border-box; }
.wf-tide__gatecard .wf-gate__headline { font-size: 12px; line-height: 1.25; }
.wf-tide__gatecard .wf-gate__sub { display: none; }
.wf-tide__gatecard .wf-gate__brand { font-size: 11px; }
.wf-tide__gatecard .wf-gate__btn { font-size: 10px; padding: 6px 8px; white-space: nowrap; }

/* Faixa de dias em HTML — dentro do SVG o texto sairia deformado pelo
   preserveAspectRatio="none", que as áreas precisam para esticar. */
.wf-tide__days {
	position: relative;
	height: 26px;
	background: var(--wf-tide-day);
	overflow: hidden;
}

.wf-tide__day {
	position: absolute;
	top: 0;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	box-sizing: border-box;
	border-left: 1px solid rgba(255, 255, 255, 0.4);
}

.wf-tide__day:first-child { border-left: 0; }

/* Clipa o que passar da caixa: rede de segurança para o rótulo de extremo não
   voltar a esticar a área rolável em algum layout que o espelhamento não pegue. */
.wf-tide__canvas {
	position: relative;
	line-height: 0;
	overflow: hidden;
}

.wf-tide__svg {
	display: block;
	width: 100%;
	height: var(--wf-tide-height);
	touch-action: pan-y;
	cursor: crosshair;
	user-select: none;
}

.wf-tide__svg:focus-visible {
	outline: 2px solid var(--wf-tide-red);
	outline-offset: 2px;
}

/* ---- rótulos dos extremos ---- */

.wf-tide__mark {
	--mx: 4px;
	--my: 0;

	position: absolute;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1px;
	transform: translate(var(--mx), var(--my));
	line-height: 1.15;
	font-size: 11px;
	font-weight: 700;
	color: var(--wf-tide-ink);
	white-space: nowrap;
	pointer-events: none;
}

/* Preamar: rótulo acima da cruzeta. Baixa-mar: abaixo. Igual ao legado. */
.wf-tide__mark--above { --my: -100%; }
.wf-tide__mark--below { --my: 2px; }

/* Perto da borda direita o rótulo espelha para dentro. Fora isso ele
   transbordava e esticava a área rolável, deixando um vão em branco depois
   da última coluna. */
.wf-tide__mark--flip {
	--mx: calc(-100% - 4px);
	align-items: flex-end;
}

.wf-tide__mark-time   { font-weight: 700; }
.wf-tide__mark-height { font-weight: 500; opacity: 0.85; }

/* ---- rodapé ---- */

.wf-tide__footer {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	padding: 10px 2px 2px;
	border-top: 1px solid var(--wf-tide-grid);
	margin-top: 2px;
}

.wf-tide__caption {
	font-size: 13px;
	color: #6b6b6b;
}

.wf-tide__reading {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
}

.wf-tide__reading strong {
	font-size: 19px;
	font-weight: 700;
	color: var(--wf-tide-ink);
}

.wf-tide__dir {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--wf-tide-day);
}

/* ---- modo "preencher o container" ----------------------------------------
   O gráfico deixa de ter altura fixa e estica até onde o container do Elementor
   permitir. A corrente inteira precisa colaborar: cada nível vira flex com
   `min-height: 0`, senão o item de flex assume a altura do conteúdo e o
   `height: 100%` de dentro não tem contra o que resolver. */

/* A altura precisa atravessar TODA a cadeia do Elementor até o componente:
       .elementor-widget-wrap → .elementor-widget → .elementor-widget-container
       → .wf-layout → .wf-tide--fill

   `height: 100%` não resolve aqui: cada um desses nós tem altura automática, e
   percentual contra `auto` não vale nada. Por isso a cadeia é feita com FLEX —
   o wrap da coluna do Elementor já é `display:flex; flex-direction:column`, e
   basta cada nível crescer dentro dele. O `min-height: 0` em todos evita que o
   conteúdo defina o piso e trave o encolhimento.

   Os seletores usam :has() para valerem só no modo preencher, sem afetar quem
   está com altura fixa nem os demais widgets do plugin. */
.elementor-widget:has(.wf-tide--fill) {
	display: flex;
	flex: 1 1 auto;
	align-self: stretch;
	min-height: 0;
}

.elementor-widget:has(.wf-tide--fill) > .elementor-widget-container {
	display: flex;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
}

.wf-layout:has(> .wf-tide--fill) {
	display: flex;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
}

.wf-tide--fill {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	height: 100%;
	min-height: 0;
}

.wf-tide--fill .wf-tide__scroll {
	flex: 1 1 auto;
	min-height: 0;
}

.wf-tide--fill .wf-tide__plot {
	height: 100%;
	min-height: 0;
}

.wf-tide--fill .wf-tide__series,
.wf-tide--fill .wf-tide__gatecol {
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.wf-tide--fill .wf-tide__canvas {
	flex: 1 1 auto;
	min-height: 0;
}

/* Sem altura fixa: o SVG ocupa o que sobrou depois da faixa de dias. */
.wf-tide--fill .wf-tide__svg {
	height: 100%;
}

/* Cabeçalho e rodapé não esticam — só o gráfico. */
.wf-tide--fill .wf-tide__header,
.wf-tide--fill .wf-tide__footer {
	flex: 0 0 auto;
}

/* ---- responsivo ---- */

@media (max-width: 782px) {
	.wf-tide { --wf-tide-height: 170px; }
	.wf-tide__mark   { font-size: 10px; }
	.wf-tide__caption { font-size: 12px; }
	.wf-tide__reading strong { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.wf-tide__svg { cursor: pointer; }
}
