/*
Theme Name: Nayapati SACCOS
Theme URI: https://nayapatisaccos.com.np/
Author: Outpace
Description: Classic WordPress theme for Nayapati Saving & Credit Cooperative Ltd. Bilingual (Nepali/English) with a Devanagari-first type system. Content comes from inc/content.php and from Secure Custom Fields — a flexible-content page builder, reports and downloads, photo galleries, and scheduled page-load popups. Renders without SCF, on built-in defaults.
Version: 0.14.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nayapati
Tags: cooperative, finance, bilingual, classic
*/

/* -------------------------------------------------------------------------
   Utilities come from the compiled Tailwind build (assets/css/tailwind.css,
   configured in tailwind.config.js), which is enqueued BEFORE this file so
   the rules here win.

   This file carries only what Tailwind cannot express: the Devanagari type
   system, the brand gradients, the ticker keyframes, focus styling, and the
   ?audit=1 affordance.
   ---------------------------------------------------------------------- */

:root {
	/* Pulled from the Nayapati logo: orange wordmark, green strapline, red rule. */
	--np-orange: #f47920;
	--np-orange-dark: #c85e14;
	--np-green: #009b48;
	--np-green-dark: #00632e;
	--np-red: #e31e24;
	--np-ink: #0b1f14;
}

/* ---------------------------------------------------------------- type */

/* Keep small text at least 16px in both languages. */
:root {
	--np-text-2xs: 1rem;
	--np-text-xs: 1rem;
	--np-text-sm: 1rem;
	--np-leading-small: 1.5rem;
}

/* Devanagari needs extra leading, including on ne-NP responses. */
html:lang(ne) {
	--np-leading-small: 1.75rem;
}

body {
	font-family: 'Mukta', 'Noto Sans Devanagari', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
	font-feature-settings: 'kern' 1;
	text-rendering: optimizeLegibility;
}

/* Devanagari sits lower in its em box than Latin and needs more leading. */
html[lang='ne'] body {
	line-height: 1.75;
}

html[lang='ne'] h1,
html[lang='ne'] h2,
html[lang='ne'] h3,
html[lang='ne'] h4 {
	line-height: 1.45;
	letter-spacing: 0;
}

/* Latin numerals and codes inside Nepali copy should not inherit Devanagari metrics. */
.lat {
	font-family: 'Inter', system-ui, sans-serif;
	font-feature-settings: 'tnum' 1;
}

/* ------------------------------------------------------- brand gradients */

.gradient-hero {
	background:
		linear-gradient(135deg, rgba(11, 31, 20, 0.95) 0%, rgba(0, 99, 46, 0.92) 55%, rgba(196, 94, 20, 0.88) 100%);
}

.gradient-brand-rule {
	background: linear-gradient(90deg, var(--np-green) 0%, var(--np-green) 50%, var(--np-red) 50%, var(--np-red) 100%);
}

/* Keep carousel hit areas stable while the active indicator changes shape. */
.nayapati-hero-dot::before {
	content: '';
	width: 0.55rem;
	height: 0.55rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.7);
	transition: width 180ms ease, background-color 180ms ease;
}

.nayapati-hero-dot:hover::before {
	background: #fff;
}

.nayapati-hero-dot[data-active='true']::before {
	width: 1.25rem;
	background: var(--np-orange);
}

@media (prefers-reduced-motion: reduce) {
	.nayapati-hero-dot::before {
		transition: none;
	}
}

/* Everest Forms gives its default submit button a stronger selector than the
   form's utility classes. Keep this override scoped to the contact page. */
.np-contact-form .everest-forms .evf-submit-container button[type='submit'],
.np-contact-form .everest-forms .evf-submit-container input[type='submit'],
.np-contact-form button[type='submit'],
.np-contact-form input[type='submit'] {
	width: auto;
	padding: 0.5rem 1rem;
	border: 1px solid var(--np-orange);
	border-radius: 0.5rem;
	background: var(--np-orange);
	color: #fff;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.5;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.np-contact-form .everest-forms .evf-submit-container button[type='submit']:hover:not(:disabled),
.np-contact-form .everest-forms .evf-submit-container input[type='submit']:hover:not(:disabled),
.np-contact-form button[type='submit']:hover:not(:disabled),
.np-contact-form input[type='submit']:hover:not(:disabled) {
	background: #dd6512;
	border-color: #dd6512;
	color: #fff;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
}

.np-contact-form button[type='submit']:focus-visible,
.np-contact-form input[type='submit']:focus-visible {
	outline: 2px solid var(--np-orange-dark);
	outline-offset: 3px;
}

/* Desktop hover is CSS-first; touch and keyboard use the disclosure script. */
#nayapati-apply-menu {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.np-apply-menu.is-open #nayapati-apply-menu {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

@media (hover: hover) {
	.np-apply-menu:not(.is-dismissed):hover #nayapati-apply-menu {
		visibility: visible;
		opacity: 1;
		pointer-events: auto;
	}
}

/* Bridge the small visual gap between the button and its dropdown. */
#nayapati-apply-menu::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	height: 0.5rem;
}

/* ------------------------------------------------------------- ticker */

.ticker-wrap {
	overflow: hidden;
	white-space: nowrap;
}

.ticker-move {
	display: inline-block;
	white-space: nowrap;
	animation: ticker 38s linear infinite;
}

.ticker-move:hover,
.ticker-move:focus-within {
	animation-play-state: paused;
}

@keyframes ticker {
	0% {
		transform: translate3d(0, 0, 0);
	}

	100% {
		transform: translate3d(-50%, 0, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ticker-move {
		animation: none;
		white-space: normal;
	}
}

/* ------------------------------------------------------------- footer */

/*
 * Soft light adds depth without competing with the footer's denser content.
 * The solid colour still comes from the Tailwind coop-900 utility.
 */
.np-footer-pattern {
	background-image:
		radial-gradient(ellipse 65% 90% at 0% 0%, rgb(255 255 255 / 7%), transparent 72%),
		radial-gradient(ellipse 50% 65% at 100% 100%, rgb(0 0 0 / 8%), transparent 80%);
}

.np-footer-links a {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	color: rgb(255 255 255 / 85%);
	font-size: var(--np-text-sm, 0.9375rem);
	line-height: var(--np-leading-small, 1.55rem);
	transition: color 150ms ease;
}

.np-footer-links a:hover,
.np-footer-links a:focus-visible {
	color: #fdba74;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* ------------------------------------------------------ translation */

/*
 * Translation is TranslatePress's job: each language has its own URL and the
 * page carries one language only. There is no CSS here that hides a language.
 *
 * What remains is the audit affordance - ?audit=1 outlines any string the
 * theme knows it has no English for, so the gaps are findable at a glance.
 */
body.nayapati-audit [data-lang-todo] {
	outline: 2px dashed var(--np-red);
	outline-offset: 2px;
}

/* TranslatePress's own switcher is not used; the theme renders its own. */
#trp-floater-ls {
	display: none !important;
}

/* ------------------------------------------------------------ a11y */

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100;
}

.skip-link:focus {
	left: 1rem;
	top: 1rem;
	padding: 0.75rem 1rem;
	background: #fff;
	color: var(--np-green-dark);
	font-weight: 700;
	border-radius: 0.5rem;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--np-orange);
	outline-offset: 2px;
	border-radius: 0.375rem;
}

/* Keep the number field and its unit inside one visible focus indicator. */
#nayapati-emi .emi-number:focus-within {
	border-color: var(--np-orange);
	outline: 2px solid var(--np-orange);
	outline-offset: 2px;
}

#nayapati-emi .emi-number input:focus-visible {
	outline: none;
}

#nayapati-emi input[type='range']:focus-visible {
	outline: 2px solid var(--np-orange);
	outline-offset: 6px;
}

/* ------------------------------------------------------------ prose */

.np-prose p {
	margin-bottom: 1rem;
}

.np-prose p:last-child {
	margin-bottom: 0;
}

.np-prose ul {
	list-style: disc;
	padding-left: 1.5rem;
	margin-bottom: 1rem;
}

.np-prose h2,
.np-prose h3,
.np-prose h4 {
	font-weight: 800;
	color: #0f172a;
	margin: 1.75rem 0 0.75rem;
}

.np-prose a {
	color: var(--np-green-dark);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Line clamping for card excerpts. */
.clamp-3 {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.clamp-2 {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* --------------------------------------------------------- WP core */

.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	word-wrap: normal !important;
}

.alignleft {
	float: left;
	margin: 0 1.5rem 1rem 0;
}

.alignright {
	float: right;
	margin: 0 0 1rem 1.5rem;
}

.aligncenter {
	display: block;
	margin-inline: auto;
}

.wp-caption-text {
	font-size: var(--np-text-2xs, 0.75rem);
	color: #64748b;
	margin-top: 0.5rem;
}

/* Remittance logos lead into a balanced pair of reference-rate cards. */
.np-partner-strip {
	display: grid;
	gap: 1.25rem;
	padding-bottom: 2rem;
}

.np-partner-window {
	min-width: 0;
	overflow: hidden;
}

.np-partner-track {
	display: flex;
	animation: np-partners 28s linear infinite;
}

.np-partner-logos {
	display: flex;
	flex: 0 0 auto;
	min-width: 100%;
	align-items: center;
	justify-content: space-around;
	gap: 3rem;
	padding: 1rem 1.5rem;
}

.np-partner-logos li {
	flex: 0 0 10rem;
}

.np-partner-strip:hover .np-partner-track,
.np-partner-strip:focus-within .np-partner-track {
	animation-play-state: paused;
}

@keyframes np-partners {
	to { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
	.np-partner-track { animation: none; }
	.np-partner-logos[aria-hidden='true'] { display: none; }
}

.np-partner-logos img {
	max-width: 100%;
	margin-inline: auto;
}

.np-market-rates {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1.5rem;
}

.np-market-rates > section {
	min-width: 0;
	display: flex;
	flex-direction: column;
	box-shadow: 0 2px 8px rgb(15 23 42 / 3%);
}

.np-market-rates > section:only-child {
	grid-column: 1 / -1;
}

.np-market-rates > section > table {
	flex: 1;
	font-variant-numeric: tabular-nums;
}

.np-market-rates #gold-silver td:last-child {
	padding-right: 1rem;
}

.np-metal-image {
	width: 3rem;
	height: 2.25rem;
	flex-shrink: 0;
	object-fit: contain;
}

@media (max-width: 767px) {
	.np-partner-strip {
		flex-direction: column;
		align-items: stretch;
		gap: 1.25rem;
	}
	.np-market-rates {
		grid-template-columns: minmax(0, 1fr);
	}
	.np-metal-image {
		width: 2rem;
		height: 1.5rem;
	}
}

/* Keep the header and rate cards usable on 320px-wide phones. */
@media (max-width: 399px) {
	.np-main-header-inner {
		flex-wrap: wrap;
		justify-content: center;
	}

	.np-header-brand,
	.np-header-actions {
		width: 100%;
		justify-content: center;
	}

	.np-market-rates .np-metal-image {
		display: none;
	}

	.np-market-rates th:first-child,
	.np-market-rates td:first-child {
		padding-left: 0.5rem;
	}

	.np-market-rates th:last-child,
	.np-market-rates td:last-child,
	.np-market-rates #gold-silver td:last-child {
		padding-right: 0.5rem;
	}
}

/* ------------------------------------------------------------ popups */

/*
 * template-parts/popup.php. The <dialog> is a bare frame: no padding, so the
 * panel fills it and a click on the dialog itself can only be the backdrop.
 */
.nayapati-popup {
	padding: 0;
	border: 0;
	background: transparent;
	max-height: calc(100dvh - 2rem);
	overflow: auto;
	overscroll-behavior: contain;
}

.nayapati-popup::backdrop {
	background: rgb(11 31 20 / 65%);
}

/* A corner popup is non-modal: the page behind it stays usable. */
.nayapati-popup[data-position='corner'] {
	position: fixed;
	inset: auto 1rem 1rem auto;
	margin: 0;
	z-index: 60;
	max-width: min(24rem, calc(100% - 2rem));
}

.nayapati-popup[data-position='corner'] > div {
	box-shadow: 0 20px 50px rgb(15 23 42 / 25%);
}

/* A modal popup stops the page scrolling underneath it. */
html:has(.nayapati-popup[data-position='center'][open]) {
	overflow: hidden;
}

.nayapati-popup[open] {
	animation: np-popup-in 0.2s ease-out;
}

.nayapati-popup[data-position='center'][open]::backdrop {
	animation: np-popup-fade 0.2s ease-out;
}

@keyframes np-popup-in {
	from {
		opacity: 0;
		transform: translateY(0.5rem);
	}
}

@keyframes np-popup-fade {
	from {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nayapati-popup[open],
	.nayapati-popup[data-position='center'][open]::backdrop {
		animation: none;
	}
}

@media print {
	.no-print {
		display: none !important;
	}
}

/* ---------------------------------------------- Nepali contact typing */
.np-nepali-input {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
	padding: 0.75rem 0.875rem;
	border: 1px solid rgb(187 247 208);
	border-radius: 0.75rem;
	background: rgb(240 253 244);
	color: rgb(22 101 52);
	font-size: 0.8125rem;
	font-weight: 700;
}

.np-nepali-input__copy {
	display: grid;
	gap: 0.15rem;
}

.np-nepali-input__copy small {
	color: rgb(71 85 105);
	font-size: 0.75rem;
	font-weight: 500;
}

.np-nepali-input__toggle {
	min-width: 6.75rem;
	padding: 0.4rem 0.75rem;
	border: 1px solid rgb(21 128 61);
	border-radius: 9999px;
	background: rgb(21 128 61);
	color: white;
	font: inherit;
	cursor: pointer;
}
.np-nepali-input__toggle[aria-pressed='false'] { background: white; color: rgb(21 128 61); }
.np-nepali-input__toggle:focus-visible { outline: 3px solid rgb(134 239 172); outline-offset: 2px; }
