/* ==========================================================================
   KiaraHub — RESPONSIVE LAYER
   Loaded last (after base.css, jobs.css, ats.css) so these rules win the
   cascade without editing the source files. Mobile-first safety rules live
   at the top; breakpoints below go from largest → smallest screen so more
   specific (smaller) rules override the broader ones naturally.

   Breakpoints used:
     ≥1400px  kh-xl    large desktop / wide monitors
     1240-1399 kh-lg   standard laptop / desktop (theme's own max-width)
     992-1239  kh-md   small laptop
     768-991   kh-sm   tablet
     576-767   kh-xs   large phone / small tablet portrait
     <576px    kh-xxs  phone
     <400px    kh-tiny very small / older phones
   ========================================================================== */

/* --------------------------------------------------------------------
   0. GLOBAL SAFETY RULES — apply at every size
   -------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

img, svg, video, canvas {
	max-width: 100%;
	height: auto;
}

.kiarahub-wrap,
.kiarahub-header-inner,
.kiarahub-hero-inner,
.kiarahub-page-content,
.kiarahub-footer-top,
.kiarahub-footer-bottom {
	width: 100%;
}

table { max-width: 100%; }

/* Any content the theme forgets to constrain (embeds, long links, etc.) */
.kiarahub-page-content,
.kiarahub-single-content,
.kiarahub-form,
.kiarahub-widget {
	overflow-wrap: break-word;
	word-break: break-word;
}

/* --------------------------------------------------------------------
   1. ≥1400px — extra breathing room on very large screens
   -------------------------------------------------------------------- */
@media (min-width: 1400px) {
	.kiarahub-wrap,
	.kiarahub-header-inner,
	.kiarahub-hero-inner,
	.kiarahub-page-content,
	.kiarahub-footer-top,
	.kiarahub-footer-bottom {
		max-width: 1320px;
	}
}

/* --------------------------------------------------------------------
   2. 992px – 1239px — small laptop: tighten grids slightly, keep 2-col
      dashboard/archive layouts but shrink the fixed side column
   -------------------------------------------------------------------- */
@media (max-width: 1239px) {
	.kiarahub-archive-wrap,
	.kiarahub-single-job-wrap {
		grid-template-columns: 1fr 260px;
		gap: 28px;
	}
	.kiarahub-dashboard-wrap,
	.kiarahub-form-wrap {
		grid-template-columns: 1fr 240px;
		gap: 24px;
	}
	.kiarahub-app-shell { grid-template-columns: 190px 1fr; gap: 24px; }
	.kiarahub-hero-copy h1 { font-size: 40px; }
}

/* --------------------------------------------------------------------
   3. 768px – 991px — TABLET
   -------------------------------------------------------------------- */
@media (max-width: 991px) {
	.kiarahub-wrap,
	.kiarahub-page-content { padding: 0 18px; }

	/* Header actions: keep account menu but drop label text if tight */
	.kiarahub-header-inner { gap: 16px; padding: 12px 18px; }

	/* Hero */
	.kiarahub-hero-inner { padding: 36px 18px 70px; }
	.kiarahub-hero-copy h1 { font-size: 34px; }
	.kiarahub-hero-stats { gap: 24px; flex-wrap: wrap; }

	/* Sections */
	.kiarahub-section { padding: 44px 0; }
	.kiarahub-section-head { flex-wrap: wrap; gap: 10px; }

	/* Category + post grids naturally reflow via auto-fill, just tighten gap */
	.kiarahub-category-grid,
	.kiarahub-job-grid,
	ul.job_listings.kiarahub-job-grid,
	.kiarahub-post-grid { gap: 16px; }

	/* Archive / dashboard: sidebar moves below content */
	.kiarahub-archive-wrap,
	.kiarahub-single-job-wrap,
	.kiarahub-dashboard-wrap,
	.kiarahub-form-wrap {
		grid-template-columns: 1fr;
		gap: 24px;
		padding: 32px 0 48px;
	}
	.kiarahub-app-shell { grid-template-columns: 1fr; padding: 28px 0 48px; }
	.kiarahub-app-sidebar {
		position: static;
		flex-direction: row;
		flex-wrap: wrap;
		gap: 6px;
	}
	.kiarahub-sidebar-link { flex: 1 1 auto; justify-content: center; text-align: center; }

	/* Stat cards: 2 per row instead of squeezing to fit */
	.kiarahub-stat-cards { grid-template-columns: repeat(2, 1fr); }

	/* CTA banner + footer */
	.kiarahub-cta-inner { text-align: center; justify-content: center; }
	.kiarahub-footer-top { grid-template-columns: 1fr 1fr; gap: 26px; }

	/* ATS modal grid: 2 → 1 column */
	.kiarahub-modal-grid { grid-template-columns: 1fr; }

	/* Job banner (single job header) stacks logo above text on tighter widths */
	.kiarahub-job-banner-inner { gap: 16px; }
}

/* --------------------------------------------------------------------
   4. 576px – 767px — LARGE PHONE
   -------------------------------------------------------------------- */
@media (max-width: 767px) {
	.kiarahub-wrap,
	.kiarahub-page-content { padding: 0 16px; }

	/* Header */
	.kiarahub-header-inner { padding: 10px 16px; gap: 12px; }
	.kiarahub-account-name { display: none; }

	/* Hero */
	.kiarahub-hero-inner { padding: 32px 16px 56px; gap: 28px; }
	.kiarahub-eyebrow { font-size: 11px; }
	.kiarahub-hero-copy h1 { font-size: 28px; line-height: 1.18; }
	.kiarahub-hero-copy p { font-size: 14.5px; }
	.kiarahub-hero-search { flex-direction: column; padding: 8px; border-radius: 14px; }
	.kiarahub-hero-search input { width: 100%; }
	.kiarahub-hero-search .kh-btn { width: 100%; }
	.kiarahub-hero-stats { gap: 18px; }
	.kiarahub-hero-stats strong { font-size: 19px; }
	.kiarahub-hero-ctas { flex-direction: column; align-items: stretch; }
	.kiarahub-hero-ctas .kh-btn { width: 100%; }
	.kiarahub-hero-media { max-width: 240px; }

	/* Search form used on find-jobs page */
	.kiarahub-search-form { flex-direction: column; }
	.kiarahub-search-form input[type="text"] { width: 100%; }
	.kiarahub-search-form button { width: 100%; }

	/* Sections */
	.kiarahub-section h2 { font-size: 22px; }
	.kiarahub-see-all { font-size: 13px; }

	/* Grids collapse to single column comfortably */
	.kiarahub-category-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
	.kiarahub-job-grid,
	ul.job_listings.kiarahub-job-grid { grid-template-columns: 1fr; }
	.kiarahub-post-grid { grid-template-columns: 1fr; }

	/* Path cards (candidate vs employer) */
	.kiarahub-path-card { padding: 22px; }
	.kiarahub-path-ctas { flex-direction: column; }
	.kiarahub-path-ctas .kh-btn { width: 100%; }

	/* CTA banner */
	.kiarahub-cta-banner .kiarahub-wrap,
	.kiarahub-cta-inner { flex-direction: column; text-align: center; }
	.kiarahub-cta-inner .kh-btn { width: 100%; }

	/* Page banner */
	.kiarahub-page-banner { padding: 32px 0; }
	.kiarahub-page-banner h1,
	.kiarahub-page-banner .kiarahub-title { font-size: 22px; }
	.kiarahub-job-banner-inner { flex-direction: column; text-align: center; align-items: center; }
	.kiarahub-job-banner-meta { justify-content: center; }
	.kiarahub-job-banner-logo .kiarahub-company-logo { width: 60px; height: 60px; }

	/* Footer stacks to one column */
	.kiarahub-footer-top { grid-template-columns: 1fr; gap: 28px; padding: 40px 16px 28px; text-align: left; }
	.kiarahub-footer-bottom { flex-direction: column; text-align: center; padding: 16px; }
	.kiarahub-footer-nav ul { justify-content: center; flex-wrap: wrap; }

	/* Forms */
	.kiarahub-submit-job-form form,
	.kiarahub-submit-resume-form form,
	.kiarahub-form,
	.kiarahub-reset-form { padding: 20px; }
	.job_filters { padding: 16px; flex-direction: column; align-items: stretch; }
	.job_filters input, .job_filters select { width: 100%; }

	/* Job dashboard table: allow horizontal scroll instead of squashing */
	.job_dashboard { overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.job_dashboard table.job_dashboard { min-width: 560px; }

	/* Stat cards: single column on phones for readable numbers */
	.kiarahub-stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
	.kiarahub-stat-card { padding: 14px 16px; }
	.kiarahub-stat-number { font-size: 21px; }

	/* Recent applicants row wraps cleanly */
	.kiarahub-recent-row { flex-wrap: wrap; }

	/* Kanban: narrower columns so more than one is hinted on screen */
	.kiarahub-kanban-column { flex: 0 0 78vw; max-width: 300px; }

	/* Application status rows */
	.kiarahub-application-row-main { flex-direction: column; align-items: flex-start; gap: 4px; }

	/* Modal */
	.kiarahub-modal,
	.kiarahub-modal-overlay .kiarahub-modal { padding: 22px 18px; max-width: 100%; }
	.kiarahub-modal-head { flex-wrap: wrap; }

	/* Auth modal social buttons already stack; tighten padding */
	.kiarahub-social-btn { padding: 10px; }
}

/* --------------------------------------------------------------------
   5. <576px — PHONE (portrait)
   -------------------------------------------------------------------- */
@media (max-width: 575px) {
	.kiarahub-wrap,
	.kiarahub-page-content { padding: 0 14px; }

	.kiarahub-logo img { max-height: 28px; width: auto; }
	.kiarahub-logo-text { font-size: 19px; }

	.kiarahub-hero-copy h1 { font-size: 24px; }
	.kiarahub-hero-copy p { max-width: 100%; }
	.kiarahub-hero-stats { gap: 14px; }
	.kiarahub-hero-stats strong { font-size: 17px; }
	.kiarahub-hero-stats span { font-size: 10.5px; }

	.kiarahub-how-card,
	.kiarahub-path-card,
	.kiarahub-widget { padding: 18px; }

	.kiarahub-title { font-size: 22px; }

	.kiarahub-job-card a { padding: 16px; }
	.kiarahub-job-card-top { gap: 10px; }
	.kiarahub-job-card .company_logo,
	.kiarahub-company-logo { width: 40px; height: 40px; }

	.kiarahub-stat-cards { grid-template-columns: 1fr 1fr; gap: 8px; }

	.kiarahub-kanban-column { flex: 0 0 86vw; }

	.kh-btn { padding: 11px 16px; font-size: 13.5px; }
	.kh-btn-large { padding: 13px 22px; font-size: 15px; }

	.kiarahub-modal { padding: 20px 16px; }
	.kiarahub-modal-tab { font-size: 12.5px; padding: 9px; }
}

/* --------------------------------------------------------------------
   6. <400px — SMALL / OLDER PHONES
   -------------------------------------------------------------------- */
@media (max-width: 400px) {
	.kiarahub-hero-copy h1 { font-size: 21px; }
	.kiarahub-eyebrow { font-size: 10px; letter-spacing: 0.08em; }
	.kiarahub-section h2 { font-size: 19px; }
	.kiarahub-stat-cards { grid-template-columns: 1fr 1fr; }
	.kiarahub-avatar-badge { width: 32px; height: 32px; font-size: 12px; }
	.kiarahub-nav-list-mobile a { font-size: 14px; }
	.kiarahub-footer-top { padding: 32px 14px 24px; }
}

/* --------------------------------------------------------------------
   7. Landscape phones — short viewport height, wide enough for row layouts
   -------------------------------------------------------------------- */
@media (max-height: 480px) and (orientation: landscape) {
	.kiarahub-hero-inner { padding-top: 24px; padding-bottom: 32px; }
	.kiarahub-modal { max-height: 92vh; overflow-y: auto; }
	.kiarahub-kanban-column { max-height: 80vh; }
}

/* --------------------------------------------------------------------
   8. Touch-friendly tap targets on any coarse-pointer device
      (phones/tablets), independent of viewport width
   -------------------------------------------------------------------- */
@media (pointer: coarse) {
	.kh-btn,
	.kiarahub-chip,
	.kiarahub-account-btn,
	.kiarahub-mobile-toggle,
	.kiarahub-modal-close,
	.kiarahub-sidebar-link {
		min-height: 40px;
	}
	.kiarahub-nav-list-mobile a,
	.kiarahub-account-dropdown a { padding: 10px; }
}
