/* ==========================================================================
   Finora UI — Responsive behaviour
   Breakpoints: 1024 (tablet/mobile switch — also --mobile-breakpoint),
   768 (tablet), 600 (mobile), 400 (small mobile).
   ========================================================================== */

/* Desktop: drawer at full configured width.
   (Bottom-nav show/hide uses the admin breakpoint — see inc/css-variables.php.) */
@media (min-width: 1025px) {
	.finora-drawer { width: var(--drawer-width); }
}

/* Tablet & below --------------------------------------------------------- */
@media (max-width: 1024px) {
	.finora-header { height: var(--header-height-mobile); }
	body.finora-sticky-header .finora-header.is-scrolled { height: var(--header-height-mobile); }
	.finora-drawer__head { height: var(--header-height-mobile); }

	.finora-header__inner { gap: 10px; }
	.finora-header__right { gap: 8px; }

	body.finora-has-bottom-nav .finora-drawer { padding-bottom: 0; }

	/* Wallet text compacts */
	.finora-wallet__full { display: none; }
	.finora-wallet__short { display: inline; }
	.finora-wallet { font-size: .875rem; padding-right: 12px; }

	/* Tooltips off on touch-first sizes */
	[data-tooltip]::after { display: none; }
}

/* Tablet ------------------------------------------------------------------ */
@media (max-width: 768px) {
	.finora-brand__name { font-size: 1rem; }
	.finora-brand__logo--desktop:has(+ .finora-brand__logo--mobile) { display: none; }
	.finora-brand__logo--mobile { display: block; height: 32px; }
	.finora-brand__logo { height: 32px; }
	.finora-brand__mark { width: 32px; height: 32px; border-radius: 10px; }

	.finora-guest__login span { display: none; }
	.finora-guest__login { width: var(--touch); padding: 0; justify-content: center; }
	.finora-guest__register { padding-inline: 14px; }

	.finora-post-nav { grid-template-columns: 1fr; }
	.finora-post-nav__next { text-align: left; }
	.finora-comments__list .children { margin-left: 20px; }
}

/* Mobile ------------------------------------------------------------------ */
@media (max-width: 600px) {
	:root {
		--gutter: 14px;
		--theme-space: 16px;
	}

	.finora-header__inner { gap: 8px; }
	.finora-header__right { gap: 6px; }
	.finora-iconbtn { --size: 42px; border-radius: 12px; }
	.finora-account-btn { height: 42px; padding-right: 4px; gap: 2px; }
	.finora-account-btn__caret { display: none; }
	.finora-account-btn__avatar { --avatar-size: 34px; }
	.finora-wallet { height: 42px; gap: 7px; padding: 0 12px 0 5px; }
	.finora-wallet__icon { width: 30px; height: 30px; }

	/* Brand text hides when a wallet is present and room is tight */
	.finora-header__left .finora-brand__name { display: none; }
	.finora-header__left .finora-brand__mark { margin-left: 2px; }

	/* Drawer: near-full width, leave a sliver of page */
	.finora-drawer { width: min(var(--drawer-width), calc(100vw - 44px)); }
	.finora-goal { margin-inline: 14px; }
	.finora-user-card, .finora-drawer__guest { margin-inline: 14px; }
	.finora-nav { padding-inline: 10px; }

	/* Popovers → bottom sheets */
	.finora-popover.is-sheet {
		position: fixed;
		top: auto;
		left: 10px;
		right: 10px;
		bottom: calc(10px + var(--safe-bottom));
		width: auto;
		min-width: 0;
		max-height: min(78vh, 640px);
		overflow-y: auto;
		border-radius: 26px;
		transform-origin: bottom center;
		padding: 14px 12px 12px;
	}
	.finora-popover.is-sheet .finora-account-panel__grab,
	.finora-popover.is-sheet .finora-account-panel__grab {
		display: block;
		width: 40px; height: 4px;
		margin: -4px auto 12px;
		border-radius: 2px;
		background: var(--border-strong);
	}
	.finora-popover.is-sheet .finora-popover__footer-link { margin: 6px -12px -12px; border-radius: 0 0 26px 26px; }
	.finora-notif-panel.is-sheet .finora-notif-panel__body { max-height: none; }

	.finora-page-header__title { font-size: 1.5rem; }
	.finora-card { border-radius: var(--theme-radius); }
	.finora-footer__inner { padding-block: 14px; }
	.finora-footer--space-between .finora-footer__inner { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* Small mobile ------------------------------------------------------------ */
@media (max-width: 400px) {
	.finora-header__left .finora-brand { display: none; }
	.finora-header__right { gap: 5px; }
	.finora-iconbtn { --size: 40px; }
	.finora-wallet { font-size: .8125rem; padding: 0 10px 0 4px; height: 40px; }
	.finora-wallet__icon { width: 30px; height: 30px; }
	.finora-account-btn { height: 40px; }
	.finora-guest__register span { font-size: .8125rem; }
	.finora-bottom-nav__link { font-size: .625rem; }
	.finora-bottom-nav__item--center { flex-basis: 68px; }
	.finora-bottom-nav__center-btn { width: 54px; height: 54px; margin-top: -30px; }
	.finora-bottom-nav { left: 8px; right: 8px; }
	.finora-404__code { font-size: 3rem; }
}

/* Landscape phones: lower header, scrollable sheets */
@media (max-height: 480px) and (orientation: landscape) {
	.finora-popover.is-sheet { max-height: 88vh; }
	.finora-bottom-nav { --bottom-nav-height: 56px; }
}

/* Very wide: cap gutter */
@media (min-width: 1600px) {
	:root { --gutter: 40px; }
}
