:root {
  /* =========================================================
     UE Project Plugin – Frontend CSS Contract (Design Tokens)
     Theme controls layout; plugin provides semantic hooks + vars.
     ========================================================= */

  /* -------------------------
     Project list card vars
     ------------------------- */
  --ue-project-bg: transparent;
  --ue-project-border: rgba(0,0,0,.10);
  --ue-project-radius: 16px;

  /* List spacing */
  --ue-project-gap: 40px;      /* cards spacing */
  --ue-project-col-gap: 30px;  /* column spacing inside card */
  --ue-search-gap: 40px;       /* search-to-first-card spacing */

  --ue-project-text-color: inherit;
  --ue-project-link-color: inherit;
  --ue-project-link-hover-color: inherit;

  /* Funding button vars (project cards) */
  --ue-project-btn-bg: #d6e8c3;
  --ue-project-btn-bg-hover: #c5ddb1;
  --ue-project-btn-text: #000000;
  --ue-project-btn-text-hover: #000000;
  --ue-project-btn-border: rgba(0,0,0,.18);

  /* -------------------------
     Step list card vars
     ------------------------- */
  --ue-step-bg: #fff7b8; /* yellow contract default */
  --ue-step-border: rgba(0,0,0,.10);
  --ue-step-radius: 16px;
  --ue-step-gap: 30px; /* vertical gap between cards */

  --ue-step-text-color: inherit;
  --ue-step-link-color: inherit;
  --ue-step-link-hover-color: inherit;

  /* -------------------------
     Singles (scoped)
     ------------------------- */
  --ue-single-project-bg: transparent;
  --ue-single-project-text-color: inherit;
  --ue-single-project-link-color: inherit;
  --ue-single-project-link-hover-color: inherit;

  --ue-single-step-bg: transparent;
  --ue-single-step-text-color: inherit;
  --ue-single-step-link-color: inherit;
  --ue-single-step-link-hover-color: inherit;
}

/* =========================================================
   Search form
   ========================================================= */
.uep-search {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 var(--ue-search-gap);
}
.uep-search input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
}
.uep-search button {
  padding: 8px 12px;
}

/* =========================================================
   Lists
   ========================================================= */
.ue-projects-list {
  display: grid;
  gap: var(--ue-project-gap);
}
.ue-step-list {
  display: grid;
  gap: var(--ue-step-gap);
}

/* =========================================================
   Shared UI helpers
   ========================================================= */
.uep-button {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 10px;
  text-decoration: none;
}

/* Fact rows */
.uep-fact { margin: 6px 0; }
.uep-fact strong { margin-right: 6px; }

/* =========================================================
   Project card
   ========================================================= */
.ue-project-item {
  background: var(--ue-project-bg);
  border: 1px solid var(--ue-project-border);
  border-radius: var(--ue-project-radius);
  overflow: hidden;
  color: var(--ue-project-text-color);
}

.ue-project-item__body {
  padding: 16px;
}

/* Title row + funding button aligned */
.ue-project-item__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 14px;
}

.ue-project-item__title {
  margin: 0;
  line-height: 1.2;
}

/* FORCE override vs theme link rules */
.ue-project-item a,
.ue-project-item a:visited {
  color: var(--ue-project-link-color, inherit) !important;
  text-decoration: none;
}
.ue-project-item a:hover,
.ue-project-item a:focus {
  color: var(--ue-project-link-hover-color, var(--ue-project-link-color, inherit)) !important;
}

/* Funding button styling */
.ue-project-item .uep-button--fund {
  background: var(--ue-project-btn-bg);
  border-color: var(--ue-project-btn-border);
  color: var(--ue-project-btn-text) !important;
  font-weight: 600;
}
.ue-project-item .uep-button--fund:hover,
.ue-project-item .uep-button--fund:focus {
  background: var(--ue-project-btn-bg-hover);
  color: var(--ue-project-btn-text-hover) !important;
}

/* Featured image vertical alignment tweak (left column) */
.ue-project-item__media {
  margin-top: 10px;
}

/* Two-column card body */
.ue-project-item__content-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--ue-project-col-gap);
  align-items: stretch; /* allow both columns to match height */
}

/* LEFT column: flex stack so facts can stick to bottom */
.ue-project-item__left {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ue-project-item__thumb {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
}

/* Facts pinned to bottom of left column */
.ue-project-item__facts {
  margin-top: auto;
  padding-top: 10px;
}

/* Bottom alignment polish */
.ue-project-item__facts .uep-fact:last-child { margin-bottom: 0; }
.ue-project-item__facts p:last-child { margin-bottom: 0; }

/* RIGHT column: flex stack so tax line can stick to bottom */
.ue-project-item__right {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Excerpt + read more rhythm */
.ue-project-item__excerpt-text {
  margin: 0 0 6px 0;
}
.ue-project-item__readmore {
  display: inline-block;
  margin: 0;
  opacity: .9;
  font-weight: 500;
}

/* Domain/Type line at the bottom of right column */
.ue-project-item__taxline {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  opacity: .95;
}
.ue-project-item__taxitem strong {
  margin-right: 6px;
}

/* =========================================================
   Step card (nested grid layout)
   ========================================================= */
.ue-step-item {
  background: var(--ue-step-bg);
  border: 1px solid var(--ue-step-border);
  border-radius: var(--ue-step-radius);
  overflow: hidden;
  color: var(--ue-step-text-color);
}

.ue-step-item__body { padding: 16px; }

/* OUTER (red): left content + right image */
.ue-step-item__layout {
  display: grid;
  gap: 22px;
  align-items: start;
}
.ue-step-item__layout.has-thumb {
  grid-template-columns: 1fr 180px;
}
.ue-step-item__layout.no-thumb {
  grid-template-columns: 1fr;
}

.ue-step-item__title {
  margin: 0 0 12px;
  line-height: 1.2;
}

/* RIGHT image */
.ue-step-item__media { justify-self: end; }
.ue-step-item__thumb {
  width: 180px;
  height: auto;
  display: block;
  border-radius: 0;
}

/* INNER (blue): meta left + excerpt right */
.ue-step-item__inner-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 22px;
  align-items: start;
}

/* Vertical rhythm + line height normalization (blue grid) */
.ue-step-item__meta-col,
.ue-step-item__excerpt-col,
.ue-step-item__inner-grid,
.ue-step-item__inner-grid .uep-fact,
.ue-step-item__excerpt-text {
  line-height: 1.60;
}

/* Remove margin noise in meta column */
.ue-step-item__meta-col .uep-fact {
  margin: 0 0 0 0;
}
.ue-step-item__meta-col .uep-fact:last-child {
  margin-bottom: 0;
}

/* Clamp excerpt */
.ue-step-item__excerpt-text {
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3; /* adjust 3–6 */
  overflow: hidden;
}

/* Optional weight stabilization */
.ue-step-item__meta-col strong {
  font-weight: 600;
}

/* FORCE override vs theme link rules */
.ue-step-item a,
.ue-step-item a:visited {
  color: var(--ue-step-link-color, inherit) !important;
  text-decoration: none;
}
.ue-step-item a:hover,
.ue-step-item a:focus {
  color: var(--ue-step-link-hover-color, var(--ue-step-link-color, inherit)) !important;
}

/* =========================================================
   Singles (scoped wrappers)
   ========================================================= */
.uep-single--project {
  background: var(--ue-single-project-bg);
  color: var(--ue-single-project-text-color);
}
.uep-single--project a { color: var(--ue-single-project-link-color); }
.uep-single--project a:hover { color: var(--ue-single-project-link-hover-color); }

.uep-single--step {
  background: var(--ue-single-step-bg);
  color: var(--ue-single-step-text-color);
}
.uep-single--step a { color: var(--ue-single-step-link-color); }
.uep-single--step a:hover { color: var(--ue-single-step-link-hover-color); }

/* =========================================================
   Pagination
   ========================================================= */
.uep-pagination ul {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 18px 0 0;
}
.uep-pagination a,
.uep-pagination span {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 10px;
  text-decoration: none;
}

/* =========================================================
   Responsive rules
   ========================================================= */
@media (max-width: 900px) {

  /* Steps: keep outer 2 cols (text + small thumb) */
  .ue-step-item__layout.has-thumb {
    grid-template-columns: 1fr 150px;
  }
  .ue-step-item__thumb {
    width: 150px;
  }

  /* Steps: stack inner blue grid */
  .ue-step-item__inner-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {

  /* =========================================================
     Project cards – stack columns on mobile
     (RESTORES original mobile behavior)
     ========================================================= */
  .ue-project-item__content-grid {
    grid-template-columns: 1fr;
  }

  /* =========================================================
     Step cards – outer grid stacks; image moves below content
     ========================================================= */
  .ue-step-item__layout.has-thumb {
    grid-template-columns: 1fr;
  }

  .ue-step-item__media {
    order: 2;
    margin-top: 14px;
    justify-self: start; /* change to end if you prefer right-aligned */
  }

  .ue-step-item__thumb {
    width: 100%;
    max-width: 220px;
    height: auto;
  }

  .ue-step-item__inner-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}


/* =========================
   Singles (project + step)
   ========================= */

/* Wrapper: add top/bottom + side padding (your requirement + spacing above backlink) */
.uep-single__inner {
  padding: 40px 40px 40px;
}

/* Back link */
.uep-single__back {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  margin: 0 0 16px;
  opacity: .9;
}
.uep-single__back:hover,
.uep-single__back:focus {
  opacity: 1;
}

/* Title spacing */
.uep-single__title {
  margin: 0 0 18px;
}

/* Desktop: two equal columns with fixed gap */
.uep-single__topgrid.has-thumb {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 18px;
}

.uep-single__topgrid.no-thumb {
  display: block;
  margin-bottom: 18px;
}

/* Meta stack (force vertical list) */
.uep-single__meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.uep-single__meta-item strong {
  margin-right: 8px;
}

/* Featured image: fill right column */
.uep-single__media {
  margin: 0;
}

.uep-single__thumb {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
}

/* Content area spacing */
.uep-single__content {
  margin-top: 18px;
}

/* Funding button placement (after content, before steps) */
.uep-single__funding {
  margin: 22px 0 26px;
}

/* Ensure fund button has visible background even if vars are not set */
.uep-single--project .uep-button--fund {
  background: var(--ue-project-btn-bg, #d6e8c3);
  border-color: var(--ue-project-btn-border, rgba(0,0,0,.18));
  color: var(--ue-project-btn-text, #000) !important;
  font-weight: 600;
}
.uep-single--project .uep-button--fund:hover,
.uep-single--project .uep-button--fund:focus {
  background: var(--ue-project-btn-bg-hover, #c5ddb1);
  color: var(--ue-project-btn-text-hover, #000) !important;
}

/* Steps section spacing */
.uep-single__steps {
  margin-top: 26px;
}

/* Tablet: stack meta above image */
@media (max-width: 900px) {
  .uep-single__topgrid.has-thumb {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

/* Mobile: reduce padding */
@media (max-width: 700px) {
  .uep-single__inner {
    padding: 24px 18px 24px;
  }
}




/* =========================
   Singles – Step specific
   Yellow fills the full GP container width (1100px)
   ========================= */

/* Step single: make the inner container the yellow “card” spanning full container width */
.uep-single--step .uep-single__inner {
  background: var(--ue-step-bg);          /* reuse same yellow as step cards */
  padding: 40px;                          /* top/right/bottom/left */
  border-radius: 0;                       /* you said no rounded corners */
}

/* Keep the project single inner background untouched (still controlled by vars) */
.uep-single--project .uep-single__inner {
  padding: 40px;                          /* if you want same top/bottom rhythm on projects too */
}

/* Top grid: image left + meta right; fixed image col max 490 */
.uep-single--step .uep-single__topgrid.has-thumb {
  display: grid;
  grid-template-columns: minmax(0, 490px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  margin-bottom: 18px;
}

/* No image: single column */
.uep-single--step .uep-single__topgrid.no-thumb {
  display: block;
  margin-bottom: 18px;
}

/* Image: same sizing contract as project single */
.uep-single--step .uep-single__thumb {
  width: 100%;
  max-width: 490px;
  height: auto;
  display: block;
  border-radius: 0; /* no rounded corners */
}

/* Responsive: stack on small screens */
@media (max-width: 900px) {
  .uep-single--step .uep-single__topgrid.has-thumb {
    grid-template-columns: 1fr;
  }
}
