/*
 * Design tokens (light/dark) live in application.css's :root and
 * [data-theme="dark"] blocks, which load on every public page. Variables are
 * referenced (not redefined) here.
 */

body {
	margin: 0;
	font-family: "Space Grotesk", sans-serif;
	background:
		radial-gradient(circle at 12% 6%, rgba(141, 41, 77, 0.14), transparent 44%),
		radial-gradient(circle at 86% 18%, rgba(216, 154, 170, 0.24), transparent 38%),
		linear-gradient(160deg, #fff8fa 0%, #f1e3e7 100%);
	color: var(--ink);
	min-height: 100vh;
}

[data-theme="dark"] body {
	background:
		radial-gradient(circle at 12% 6%, rgba(224, 137, 165, 0.12), transparent 44%),
		radial-gradient(circle at 86% 18%, rgba(90, 47, 64, 0.4), transparent 38%),
		linear-gradient(160deg, #20151c 0%, #150e15 100%);
}

.landing {
	width: min(1140px, 94vw);
	margin: 0 auto;
	padding: 2.2rem 0 3.2rem;
}

/* ---------- Header actions (theme toggle + language switcher) ---------- */

.landing__header-actions {
	position: absolute;
	top: 0.85rem;
	right: 0.85rem;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.landing__lang-switch,
.landing__theme-switch,
.landing__privacy-switch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.9rem;
	height: 1.9rem;
	border-radius: 50%;
	background: transparent;
	border: 0;
	color: var(--muted);
	text-decoration: none;
	cursor: pointer;
	transition: color 160ms ease, background-color 160ms ease;
}

.landing__theme-switch,
.landing__privacy-switch {
	padding: 0;
	font: inherit;
}

.landing__theme-switch span,
.landing__privacy-switch span {
	display: flex;
	align-items: center;
	justify-content: center;
}

.landing__theme-switch span svg,
.landing__privacy-switch span svg {
	width: 1.15rem;
	height: 1.15rem;
}

.landing__lang-switch svg,
.landing__theme-switch svg,
.landing__privacy-switch svg {
	width: 1.15rem;
	height: 1.15rem;
}

.landing__lang-switch:hover,
.landing__lang-switch:focus-visible,
.landing__theme-switch:hover,
.landing__theme-switch:focus-visible,
.landing__privacy-switch:hover,
.landing__privacy-switch:focus-visible {
	color: var(--accent);
	background: var(--accent-wash);
}

.landing__lang-switch:focus-visible,
.landing__theme-switch:focus-visible,
.landing__privacy-switch:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

@media (max-width: 480px) {
	.landing__header-actions {
		top: 0.6rem;
		right: 0.6rem;
		gap: 0.15rem;
	}

	.landing__lang-switch,
	.landing__theme-switch,
	.landing__privacy-switch {
		width: 1.6rem;
		height: 1.6rem;
	}

	.landing__lang-switch svg,
	.landing__theme-switch svg,
	.landing__privacy-switch svg {
		width: 0.95rem;
		height: 0.95rem;
	}
}
/* ---------- Header ---------- */

.landing__header {
	position: relative;
	padding: clamp(2.4rem, 5vw, 3.6rem) clamp(1.5rem, 4vw, 3rem) clamp(2rem, 4vw, 2.8rem);
	margin-bottom: 1.5rem;
	border: 1px solid rgba(67, 42, 53, 0.22);
	background:
		radial-gradient(circle at 50% 0%, rgba(141, 41, 77, 0.16), transparent 60%),
		var(--header-glass);
	text-align: center;
	overflow: hidden;
}

.landing__header::before,
.landing__header::after {
	content: "";
	position: absolute;
	width: 46px;
	height: 46px;
	border: 1px solid rgba(141, 41, 77, 0.35);
	opacity: 0.8;
}

.landing__header::before {
	top: 14px;
	left: 14px;
	border-right: 0;
	border-bottom: 0;
}

.landing__header::after {
	bottom: 14px;
	right: 14px;
	border-left: 0;
	border-top: 0;
}

.landing__eyebrow {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 0.85rem;
	position: relative;
	z-index: 1;
}

.landing__header-bar {
	display: block;
	position: relative;
	z-index: 1;
	container-type: inline-size;
}

.landing__title {
	font-family: "Anton", sans-serif;
	letter-spacing: 0.02em;
	margin: 0;
	line-height: 0.98;
	font-size: clamp(2.3rem, 5vw, 3.75rem);
	text-transform: uppercase;
	overflow-wrap: break-word;
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
	color: var(--ink);
	background: linear-gradient(180deg, var(--ink) 55%, var(--accent) 160%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.landing__divider {
	display: block;
	width: 64px;
	height: 3px;
	margin: 1.1rem auto 1.2rem;
	background: linear-gradient(90deg, transparent, var(--accent), transparent);
	border-radius: 999px;
	position: relative;
	z-index: 1;
}

.landing__subtitle {
	margin: 0.65rem 0 0;
	font-size: 0.88rem;
	max-width: 55ch;
	line-height: 1.5;
	color: var(--muted-strong);
	margin-left: auto;
	margin-right: auto;
}

.directory-intro {
	width: min(100%, 42rem);
	margin: 0 auto 1.5rem;
	font-size: 0.98rem;
	line-height: 1.65;
	color: var(--muted-strong);
	text-align: center;
	position: relative;
	z-index: 1;
}

.directory-intro__short {
  display: none;
}

@media (max-width: 429px) {
  .directory-intro__full {
    display: none;
  }

  .directory-intro__short {
    display: inline;
  }
}

/* ---------- Card grid ---------- */

.cluster-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 1rem;
}

/*
 * The card is the 3D stage.
 * IMPORTANT: no overflow:hidden / border-radius here — clipping the
 * perspective container is the classic cause of the flip flattening or
 * the back bleeding through on iOS Safari. Rounding + clipping now live
 * on each face instead. The shadow stays on the stage so it doesn't spin.
 */
.cluster-card {
	position: relative;
	aspect-ratio: 3 / 4.2;
	background: transparent;
	border-radius: 1rem;
	cursor: pointer;
	outline: none;
	-webkit-perspective: 1200px;
	perspective: 1200px;
	transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1),
		filter 260ms ease;
	filter: drop-shadow(0 9px 22px rgba(43, 15, 25, 0.16));
}

.cluster-card:focus-visible,
.cluster-card:hover {
	transform: translateY(-4px) rotate(-0.35deg);
	filter: drop-shadow(0 16px 30px rgba(43, 15, 25, 0.28));
}

.cluster-card:active {
	transform: translateY(-1px) rotate(-0.15deg) scale(0.985);
}

.cluster-card[aria-disabled="true"] {
	opacity: 0.75;
	cursor: default;
}

.cluster-card[aria-disabled="true"]:hover,
.cluster-card[aria-disabled="true"]:active {
	transform: none;
	filter: drop-shadow(0 9px 22px rgba(43, 15, 25, 0.16));
}

.cluster-card__inner {
	position: relative;
	width: 100%;
	height: 100%;
	-webkit-transform-style: preserve-3d;
	transform-style: preserve-3d;
	-webkit-transition: -webkit-transform 0.62s cubic-bezier(0.4, 0.1, 0.2, 1);
	transition: transform 0.78s cubic-bezier(0.22, 0.61, 0.36, 1);
	will-change: transform;
}

.cluster-card.is-flipped .cluster-card__inner {
	-webkit-transform: rotateY(180deg);
	transform: rotateY(180deg);
}

/*
 * Chrome resolves wheel/touch scroll against the compositor's flattened
 * stacking order rather than the true 3D depth, so the z-index:2 front face
 * keeps capturing the scroll (and chaining it to the page) even after the
 * card is flipped. Swap the faces' z-index and drop pointer events on the
 * hidden face so the visible back face — and its provider list — scrolls.
 */
.cluster-card.is-flipped .cluster-card__face--front {
	z-index: 1;
	pointer-events: none;
}

.cluster-card.is-flipped .cluster-card__face--back {
	z-index: 2;
}

.cluster-card__face {
	position: absolute;
	inset: 0;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	background: var(--card);
	display: flex;
	flex-direction: column;
	height: 100%;
	/* rounding + clipping belong on the faces, not the 3D stage */
	border: 1px solid var(--line);
	border-radius: 1rem;
	overflow: hidden;
	box-sizing: border-box;
	/* promote each face to its own layer for crisp Safari rendering */
	-webkit-transform: translateZ(0);
	transform: translateZ(0);
}

.cluster-card__face--front {
	z-index: 2;
}

.cluster-card__face--back {
	-webkit-transform: rotateY(180deg) translateZ(0);
	transform: rotateY(180deg) translateZ(0);
	background: linear-gradient(160deg, var(--wine-deep) 0%, var(--wine-mid) 100%);
	color: #fbf3f6;
	border-color: var(--wine-mid);
	z-index: 1;
}

.cluster-card__media {
	flex: 1 1 auto;
	min-height: 0;
	background: linear-gradient(150deg, var(--wine-mid) 0%, var(--wine-bright) 100%);
	position: relative;
	overflow: hidden;
}

.cluster-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cluster-card__media-empty {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: #f6e3ea;
	letter-spacing: 0.06em;
	font-size: 0.85rem;
	text-transform: uppercase;
	background:
		repeating-linear-gradient(
			-45deg,
			rgba(255, 255, 255, 0.07) 0,
			rgba(255, 255, 255, 0.07) 14px,
			transparent 14px,
			transparent 28px
		);
}

/*
 * The placeholder's display:grid above overrides the UA's [hidden]{display:none},
 * so a card that HAS an image (whose empty div carries the hidden attribute)
 * would still paint "SEM IMAGEM" over it. Re-assert hidden explicitly.
 */
.cluster-card__media-empty[hidden] {
	display: none;
}

/*
 * CSS-only flip affordance — a subtle wine chip with a ↻ glyph in the
 * corner of the front face. Requires no ERB markup. Fades out once the
 * card is flipped, and is hidden entirely on disabled cards.
 */
.cluster-card__face--front::after {
	content: "\21bb"; /* ↻ */
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	width: 1.9rem;
	height: 1.9rem;
	border-radius: 50%;
	background: linear-gradient(135deg, rgba(141, 41, 77, 0.9), rgba(43, 15, 25, 0.8));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	display: grid;
	place-items: center;
	color: #fbf3f6;
	font-size: 1rem;
	line-height: 1;
	z-index: 3;
	pointer-events: none;
	transition: opacity 220ms ease, transform 220ms ease;
}

.cluster-card:hover .cluster-card__face--front::after {
	transform: rotate(45deg);
}

.cluster-card.is-flipped .cluster-card__face--front::after,
.cluster-card[aria-disabled="true"] .cluster-card__face--front::after {
	opacity: 0;
}

/* keeps working if you add the optional SVG hint element to the ERB */
.cluster-card__flip-hint {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	width: 1.9rem;
	height: 1.9rem;
	border-radius: 50%;
	background: rgba(43, 15, 25, 0.55);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	display: grid;
	place-items: center;
	color: #fbf3f6;
	z-index: 3;
	pointer-events: none;
}

.cluster-card__flip-hint svg {
	width: 1rem;
	height: 1rem;
}

.cluster-card__body {
	flex: 0 0 auto;
	padding: 0.9rem 0.95rem 1rem;
	display: grid;
	gap: 0.35rem;
	background: var(--card);
}

.cluster-card__name {
	margin: 0;
	font-weight: 700;
	letter-spacing: 0.01em;
	font-size: 1rem;
}

[data-theme="dark"] .cluster-card__face {
	background: var(--card);
	border-color: var(--line);
}

[data-theme="dark"] .cluster-card__body {
	background: var(--card);
}

[data-theme="dark"] .cluster-card__name {
	color: var(--text);
}

[data-theme="dark"] .cluster-card__location {
	color: var(--muted-strong);
}

.cluster-card__location {
	margin: 0;
	color: var(--muted-strong);
	font-weight: 500;
	font-size: 0.92rem;
}

.cluster-card__target {
	color: var(--accent);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 700;
	margin-top: 0.2rem;
}

/*
 * Privacy mode (privacy toggle) — applies a heavy blur to every card image,
 * leaving the descriptions/labels fully readable. Driven by the
 * `privacy-blur` class on <html>, toggled by the privacy Stimulus controller
 * and pre-painted from the privacy cookie in the layout.
 */
html.privacy-blur .cluster-card__media img {
	filter: blur(1.4rem) saturate(1.1);
	transform: scale(1.08);
}

html.privacy-blur .cluster-card__media-empty {
	filter: blur(0.6rem);
}

/* ---------- Promotion (paid ad) cards ---------- */

.cluster-card--promotion .cluster-card__face--front {
	border: 1px solid #e0c93d;
	background: #fffbe8;
}

.cluster-card--promotion .cluster-card__media {
	background: linear-gradient(150deg, #b8a32f 0%, #e0c93d 100%);
}

.cluster-card__target--promotion {
	color: #b8951a;
}

[data-theme="dark"] .cluster-card--promotion .cluster-card__face--front {
	background: #36301a;
}

[data-theme="dark"] .cluster-card__target--promotion {
	color: #e6cf5e;
}

/* Reserve one line the same height as a normal card's location line so the
   paid card's body/media (and therefore its image) matches normal cards
   exactly. Hidden — the promo has no location to show. */
.cluster-card__location-reserve {
	display: block;
	margin: 0;
	font-size: 0.92rem;
	font-weight: 500;
	visibility: hidden;
}

/* ---------- Card back ---------- */

.cluster-card__back {
	display: grid;
	grid-template-rows: auto 1fr;   /* header takes its content height, list gets the rest */
	height: 100%;
	min-height: 0;
	padding: 0.9rem 0.9rem 0.75rem;
	box-sizing: border-box;
}

.cluster-card__back-header {
	/* remove flex: 0 0 auto — not needed in a grid, first row sizes to content by default */
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
	padding-bottom: 0.6rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.cluster-card__back-title {
	margin: 0;
	font-size: 0.8rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.72);
}

.cluster-card__back-count {
	font-size: 0.72rem;
	color: #fbf3f6;
	font-weight: 700;
	background: rgba(255, 255, 255, 0.14);
	border-radius: 999px;
	padding: 0.12rem 0.55rem;
}

/*
 * NOTE: the provider list must NOT be a grid container. Grid implicit rows
 * collapse to share a definite container height when their items have
 * overflow != visible (automatic minimum size = 0), which crushes every
 * .cluster-card__provider below its content height; each provider then
 * clips itself via its own overflow:hidden, the list never overflows, and
 * overflow-y:auto has nothing to scroll. Block flow keeps natural heights.
 */
.cluster-card__provider-list {
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding-right: 0.3rem;
	display: grid;
	grid-auto-rows: min-content;   /* NEW — forces rows to their content height, not shared/crushed space */
	min-height: 0;
}

.cluster-card__provider + .cluster-card__provider {
	margin-top: 0.75rem;
}

.cluster-card__link-list {
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding-right: 0.3rem;
	display: grid;
	gap: 0.45rem;
	align-content: start;
	min-height: 0;
}

.cluster-card__provider {
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 0.7rem;
	background: rgba(255, 255, 255, 0.06);
	overflow: hidden;
	min-height: min-content;   /* THIS — confirm it's actually present in shipped CSS */
}

.cluster-card__provider--single {
	border: 0;
	background: transparent;
	overflow: visible;
	/* headroom so the absolutely-positioned age chip clears the scroll container */
	margin-top: 0.45rem;
}

.cluster-card__provider-toggle {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 0.7rem 0.75rem;
	border: 0;
	background: transparent;
	color: #fff;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
	transition: background-color 160ms ease;
}

.cluster-card__provider-toggle:hover,
.cluster-card__provider-toggle[aria-expanded="true"] {
	background: rgba(255, 255, 255, 0.1);
}

.cluster-card__provider-links {
	display: grid;
	gap: 0.35rem;
	padding: 0.65rem 0.55rem 0.55rem;
}

.cluster-card__provider-links[hidden] {
	display: none;
}

.cluster-card__link {
	position: relative;
	display: block;
	padding: 0.7rem 0.75rem;
	border-radius: 0.7rem;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	text-decoration: none;
	font-size: 0.78rem;
	line-height: 1.3;
	word-break: break-word;
	border: 1px solid rgba(255, 255, 255, 0.08);
	transition: background-color 160ms ease;
}

.cluster-card__provider--single .cluster-card__provider-toggle {
	position: relative;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 0.7rem;
}

.cluster-card--single-link .cluster-card__link-list {
	align-content: center;
}

.cluster-card--single-link .cluster-card__link {
	padding: 0.9rem 0.8rem;
	font-size: 0.82rem;
}

.cluster-card__link:hover {
	background: rgba(255, 255, 255, 0.16);
}

/*
 * "Last seen" tag pinned over the link's top-right border. Absolutely
 * positioned, so the label/domain text keeps its natural flow and the
 * chip never shifts it.
 */
.cluster-card__link-age {
	position: absolute;
	top: 0;
	right: 0.55rem;
	transform: translateY(-50%);
	z-index: 1;
	padding: 0 0.4rem;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 999px;
	/* solid wine tone so it masks the link border passing behind it */
	background: var(--wine-mid);
	color: rgba(255, 255, 255, 0.62);
	font-size: 0.6rem;
	font-weight: 500;
	letter-spacing: 0.03em;
	line-height: 1.45;
	white-space: nowrap;
}

.cluster-card__provider-list,
.cluster-card__link-list {
	/* WebKit / Blink (Chrome, Safari, Edge) */
	-webkit-backface-visibility: visible;
	backface-visibility: visible;
	-webkit-transform: translateZ(0);
	transform: translateZ(0);
	touch-action: pan-y; 
	scrollbar-width: thin; /* Firefox: 'thin' or 'auto' */
	scrollbar-color: rgba(216, 154, 170, 0.5) transparent; /* Firefox: thumb track */
}


.cluster-card__provider-list::-webkit-scrollbar,
.cluster-card__link-list::-webkit-scrollbar {
	width: 6px;
}

.cluster-card__provider-list::-webkit-scrollbar-track,
.cluster-card__link-list::-webkit-scrollbar-track {
	background: transparent;
}

.cluster-card__provider-list::-webkit-scrollbar-thumb,
.cluster-card__link-list::-webkit-scrollbar-thumb {
	background-color: rgba(216, 154, 170, 0.5);
	border-radius: 999px;
	border: 1px solid transparent;
	background-clip: padding-box;
}

.cluster-card__provider-list::-webkit-scrollbar-thumb:hover,
.cluster-card__link-list::-webkit-scrollbar-thumb:hover {
	background-color: rgba(216, 154, 170, 0.8);
}

/* ---------- Empty / pagination ---------- */

.landing__empty {
	border: 1px dashed var(--line);
	border-radius: 1rem;
	padding: 2rem;
	text-align: center;
	background: var(--panel);
	font-weight: 500;
}

.landing__pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.75rem;
	padding-top: 1.5rem;
	flex-wrap: wrap;
}

.landing__pagination-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.62rem 0.95rem;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: var(--panel);
	color: var(--ink);
	text-decoration: none;
	font-weight: 700;
	transition: background-color 160ms ease, border-color 160ms ease;
}

.landing__pagination-link:hover {
	background: var(--accent-wash);
	border-color: var(--accent);
}

.landing__pagination-current {
	font-size: 0.9rem;
	color: var(--muted-strong);
	font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
	.landing {
		padding-top: 1.4rem;
	}

	.cluster-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0.8rem;
	}

	.cluster-card {
		aspect-ratio: 3 / 4.6;
	}

	.cluster-card__body {
		padding: 0.8rem;
	}

/*
	 * Mobile hero: the header leads the site, but it must NOT eat the whole
	 * viewport — the filter bar follows it and together they'd push every ad
	 * below the fold. Give it a strong-but-proportional band (~2/5 of the
	 * screen) so the listing heading and first cards peek above the fold.
	 */
	.landing--hero .landing__header {
		min-height: clamp(280px, 38vh, 420px);
		min-height: clamp(280px, 35dvh, 420px);
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.landing__title {
		/* Sizes off the header-bar's own width (container query unit) so even
		 * the longest single word always fits on one line — no mid-word
		 * breaking like "Acompanhante\s" on narrow screens. */
		font-size: min(13cqw, 3.75rem);
	}

	.landing--hero .directory-intro {
		margin-bottom: 0;
		font-size: 1rem;
	}
}

@media (max-width: 430px) {
	.cluster-grid {
		grid-template-columns: 1fr;
	}

	.cluster-card {
		aspect-ratio: 4 / 5;
	}

	.landing--hero .landing__header::before,
	.landing--hero .landing__header::after {
		width: 30px;
		height: 30px;
	}

	.landing--hero .landing__header::before {
		top: 10px;
		left: 10px;
	}

	.landing--hero .landing__header::after {
		bottom: 10px;
		right: 10px;
	}
}

/*
 * Touch devices: keep the flip feeling good, only drop the hover lift.
 */
@media (hover: none) {
	.cluster-card:hover {
		transform: none;
		filter: drop-shadow(0 9px 22px rgba(43, 15, 25, 0.16));
	}

	.cluster-card:hover .cluster-card__face--front::after {
		transform: none;
	}

	.cluster-card:active {
		transform: scale(0.985);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cluster-card,
	.cluster-card__inner,
	.cluster-card__face--front::after {
		-webkit-transition: none;
		transition: none;
	}
}
