/* Modern layout primitives (Flexbox-based)
   Scope: layout utilities, cards, forms, accessibility helpers
   Responsive behaviour relies on intrinsic flex wrapping — no media queries. */

/* CSS Reset / Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: #111827; background: #fff; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji'; line-height: 1.5; }
img, video { max-width: 100%; height: auto; display: block; }
picture { display: block; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Accessibility */
.u-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus { outline: none; }
:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* Color System */
:root {
  --color-bg: #ffffff;
  --color-fg: #111827; /* gray-900 */
  --color-muted: #6b7280; /* gray-500 */
  --color-border: #e5e7eb; /* gray-200 */
  --color-primary: #2563eb; /* blue-600 */
  --color-primary-700: #1d4ed8; /* blue-700 */
  --color-primary-50: #eff6ff; /* blue-50 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.08);
  --shadow: 0 6px 16px rgba(0,0,0,.1);
}

/* Layout Primitives */
.l-container {
  width: min(100%, 1280px);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.l-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap, 1.5rem);
}

.l-col {
  flex: 1 1 320px;
  max-width: 100%;
  min-width: 0;
}

.l-col-12,
.l-col-12\@md,
.l-col-12\@lg,
.l-col-12\@xl { flex-basis: 100%; }

.l-col-8,
.l-col-8\@md,
.l-col-8\@lg,
.l-col-8\@xl { flex-basis: clamp(320px, 66.6667%, 100%); }

.l-col-6,
.l-col-6\@md,
.l-col-6\@lg,
.l-col-6\@xl { flex-basis: clamp(280px, 50%, 100%); }

.l-col-4,
.l-col-4\@md,
.l-col-4\@lg,
.l-col-4\@xl { flex-basis: clamp(240px, 33.3333%, 100%); }

.l-col-3,
.l-col-3\@md,
.l-col-3\@lg,
.l-col-3\@xl { flex-basis: clamp(200px, 25%, 100%); }

/* Utilities */
.u-flex { display: flex; }
.u-inline-flex { display: inline-flex; }
.u-wrap { flex-wrap: wrap; }
.u-items-center { align-items: center; }
.u-items-start { align-items: flex-start; }
.u-items-end { align-items: flex-end; }
.u-justify-between { justify-content: space-between; }
.u-justify-center { justify-content: center; }
.u-gap-0 { gap: 0; }
.u-gap-2 { gap: .5rem; }
.u-gap-3 { gap: .75rem; }
.u-gap-4 { gap: 1rem; }
.u-gap-6 { gap: 1.5rem; }
.u-mt-4 { margin-top: 1rem; }
.u-mb-4 { margin-bottom: 1rem; }
.u-pt-4 { padding-top: 1rem; }
.u-pb-4 { padding-bottom: 1rem; }
.u-px-2 { padding-left: .5rem; padding-right: .5rem; }
.u-px-4 { padding-left: 1rem; padding-right: 1rem; }
.u-py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.u-order-1,
.u-order-1\@md,
.u-order-1\@lg,
.u-order-1\@xl { order: 1; }
.u-order-2,
.u-order-2\@md,
.u-order-2\@lg,
.u-order-2\@xl { order: 2; }
.u-rounded { border-radius: var(--radius-sm); }
.u-shadow-sm { box-shadow: var(--shadow-sm); }
.u-shadow { box-shadow: var(--shadow); }
.u-text-muted { color: var(--color-muted); }
.u-text-center { text-align: center; }
.u-w-full { width: 100%; }

/* Aspect ratios and media placeholders */
.u-aspect { position: relative; width: 100%; overflow: hidden; background: #f3f4f6; }
.u-aspect > img, .u-aspect > picture, .u-aspect > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.u-aspect-1x1 { aspect-ratio: 1 / 1; }
.u-aspect-4x3 { aspect-ratio: 4 / 3; }
.u-aspect-16x9 { aspect-ratio: 16 / 9; }

/* Buttons */
.c-button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.5rem; padding: .5rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--color-border); color: #111827; text-decoration: none; font-weight: 600; line-height: 1.2; transition: background .2s ease, color .2s ease, border-color .2s ease, transform .02s ease; }
.c-button:hover { filter: brightness(0.98); }
.c-button:active { transform: translateY(1px); }
.c-button:disabled, .c-button[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }

.c-button--primary { background: var(--color-primary); color: #fff; }
.c-button--primary:hover { background: var(--color-primary-700); }
.c-button--secondary { background: #fff; color: var(--color-primary); border-color: var(--color-primary); }
.c-button--secondary:hover { background: var(--color-primary-50); }
.c-button--ghost { background: transparent; color: var(--color-primary); border-color: transparent; }
.c-button--ghost:hover { background: var(--color-primary-50); }

/* Legacy button shims */
.btn { /* LEGACY shim to new button */ }
.btn, .apply-button { 
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.5rem;
  padding: .5rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--color-primary); color: #fff; font-weight: 600; text-decoration: none;
}
.btn:hover, .apply-button:hover { background: var(--color-primary-700); }

/* Navigation */
.c-topbar { position: sticky; top: 0; z-index: 100; background: #fff; border-bottom: 1px solid var(--color-border); }
.c-topbar__row { min-height: 56px; }
.c-nav__toggle { display: inline-flex; align-items: center; padding: .25rem .5rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.c-nav { width: auto; flex: 1 1 100%; min-width: 0; }
.c-nav__list { display: flex; flex-wrap: wrap; gap: 1rem; list-style: none; margin: 0; padding: 0; }
.c-nav__link { display: inline-flex; padding: .25rem .5rem; color: inherit; text-decoration: none; border-radius: var(--radius-sm); }
.c-nav__link:hover, .c-nav__link:focus-visible { background: var(--color-primary-50); }

/* Cards */
.c-card { display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.c-card__media img { width: 100%; height: auto; display: block; }
.c-card__body { padding: 1rem; }
.c-card__title { font-size: 1rem; margin: 0 0 .25rem; }
.c-card__meta { font-size: .875rem; color: var(--color-muted); }

.job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

.job-grid .grid-sb-wrap {
  float: none;
  width: 100% !important;
  padding: 0;
}

.job-grid .col-md-4 {
  flex: none;
  max-width: none;
}

.job-grid .c-grid-card {
  height: 100%;
}

/* Sidebar + widgets */
.c-sidebar { display: block; }
.c-sidebar--sticky { position: sticky; top: clamp(70px, 8vh, 110px); }
.c-widget { border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 1rem; }
.c-widget__header { padding: .75rem 1rem; background: #f9fafb; border-bottom: 1px solid var(--color-border); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .75rem; color: #6b7280; }
.c-widget__body { padding: 1rem; }
.c-list-reset { list-style: none; margin: 0; padding: 0; }
.c-media.c-media--sm { gap: .75rem; }
.c-media.c-media--sm .c-media__img { width: 64px; height: 64px; }
.c-media.c-media--sm .c-media__img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.c-widget a { color: inherit; text-decoration: none; }
.c-widget a:hover { text-decoration: underline; }

/* Grid cards used in list pages (keeps Isotope hooks) */
.c-grid-card { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.c-grid-card__media { display: block; }
.c-grid-card__body { padding: .75rem 1rem; display: flex; flex-direction: column; gap: .25rem; flex: 1 1 auto; }
.c-grid-card__title { font-size: 1rem; margin: 0; }
.c-grid-card__title a { color: inherit; text-decoration: none; }
.c-grid-card__title a:hover { text-decoration: underline; }

/* Forms */
.c-input { width: 100%; padding: .5rem .75rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fff; }
.c-input:focus-visible { border-color: var(--color-primary); box-shadow: 0 0 0 4px var(--color-primary-50); }
.c-label { font-weight: 600; font-size: .875rem; margin-bottom: .25rem; display: inline-block; }

/* Media blocks */
.c-media { display: flex; gap: 1rem; align-items: flex-start; }
.c-media__img { flex: 0 0 auto; }
.c-media__body { flex: 1 1 auto; min-width: 0; }

/* Responsive helpers */
.hide-sm { display: none !important; }
.show-sm { display: inline-block; }

/* Page/section helpers */
.section { padding-block: 2rem; }
.section--muted { background: #f9fafb; }

/* Legacy alignment shims (non-destructive) */
.fl-right { float: none; }
.fl-left { float: none; }

/* NEW: Override legacy floats in two-column content + sidebar layout */
.article-holder.l-row .col-wrap,
.article-holder.l-row .main-sidebar { float: none; width: auto; }
.article-holder.l-row .main-sidebar { padding-left: 0; }
.article-holder.l-row > .col-wrap,
.article-holder.l-row > .article-wrap {
  flex: 2 1 clamp(320px, 66.6667%, 100%);
  max-width: 100%;
}
.article-holder.l-row > .main-sidebar {
  flex: 1 1 clamp(260px, 20.3333%, 100%);
  max-width: 100%;
}

/* Images responsiveness guard */
main img, article img, .content img { max-width: 100%; height: auto; }
