/* LSR Entities front-end helpers */

/* Project facts: label + value on same line */
.lsr-project-facts__dl { margin: 0; }
.lsr-project-facts__row { display: block; margin: 0 0 1.25rem; }
.lsr-project-facts__dt,
.lsr-project-facts__dd { display: inline; margin: 0; }
.lsr-project-facts__dt {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.9rem;
}
.lsr-project-facts__dt::after { content: ": "; }
.lsr-project-facts__dd {
  font-weight: 400;
  font-size:0.9rem;
}
.lsr-project-facts__dd em,
.lsr-project-facts__dd i {
  font-style: italic;
}


/* Donor logos slider */
.lsr-donor-logos{
  display:grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 12px;
  align-items:center;
  margin-top:50px;
}
.lsr-donor-logos__viewport{
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.lsr-donor-logos__viewport::-webkit-scrollbar{ display:none; }
.lsr-donor-logos__track{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  gap: 28px;
  align-items:center;
  justify-content:center;
}
.lsr-donor-logos__item{ flex:0 0 auto; scroll-snap-align:start; }
.lsr-donor-logos__link, .lsr-donor-logos__nolink{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:.25rem .5rem;
}
.lsr-donor-logos__img{
  display:block;
  height:64px;
  width:auto;
  max-width:200px;
  object-fit:contain;
  filter: grayscale(1);
  opacity:.85;
  transition: filter .2s ease, opacity .2s ease, transform .2s ease;
}
.lsr-donor-logos__link:hover .lsr-donor-logos__img,
.lsr-donor-logos__link:focus-visible .lsr-donor-logos__img{
  filter: grayscale(0);
  opacity:1;
  transform: scale(1.03);
}
.lsr-donor-logos__nav{
  width:44px;
  height:44px;
  border-radius:999px;
  border:0 solid rgba(0,0,0,.15);
  background: transparent;
  cursor:pointer;
  padding:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  color: currentColor;
  font-size:28px;
}
.lsr-donor-logos__nav:hover{
  border-color: rgba(0,0,0,.35);
}
.lsr-donor-logos__nav:disabled{
  opacity:.4;
  cursor:default;
}
.lsr-donor-logos__nav--prev::before{ content:"←"; font-size:22px; }
.lsr-donor-logos__nav--next::before{ content:"→"; font-size:22px; }
@media (max-width: 480px){
  .lsr-donor-logos{
    grid-template-columns: 1fr;
  }
  .lsr-donor-logos__nav{
    display:none;
  }
}


/* Funded Projects (filters + grid) */
.lsr-funded-projects{
  margin-bottom:60px;
  padding-top:30px !important;
}

.lsr-funded-projects__filters {
  margin-bottom: 3rem;
}

.lsr-funded-projects__filters-inner{
  display:flex;
  flex-wrap:wrap;
  gap:0.75rem 1rem;
  align-items:flex-end;
  width:100%;
  max-width:100%;
  /* Yksi mitta selectille ja Suodata-napille (rem = sama kaikilla, ei em-vanhenemista) */
  --lsr-fp-control-fs: 0.95rem;
  --lsr-fp-control-lh: 1.35;
  --lsr-fp-control-py: 0.57rem; /* vastaa 0.6em @ 0.95rem */
  /* Kiinteä yksirivinen korkeus: reunat + pystypadding + yksi tekstirivi */
  --lsr-fp-control-h: calc(2px + 2 * var(--lsr-fp-control-py) + var(--lsr-fp-control-lh) * var(--lsr-fp-control-fs));
}

.lsr-funded-projects__filter{
  flex:1 1 11rem;
  /* Ei min-width:0 — flex voi kutistaa sarakkeen ~0 ja labelit rivittyvät merkki kerrallaan */
  min-width:min(11rem, 100%);
  display:flex;
  flex-direction:column;
  align-items:stretch;
  /* Ei width:100% — flex-wrapissa jokainen rivittäisi oman rivin */
  width:auto;
  max-width:100%;
  box-sizing:border-box;
}

.lsr-funded-projects__filter-label{
  display:block;
  font-weight:700;
  margin:0 0 .35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.65;
  margin-bottom: 4px;
  white-space:normal;
  word-break:normal;
  overflow-wrap:break-word;
}

/* Native select: fallback when JS off; hidden when enhanced */
.lsr-funded-projects__filter select:not(.lsr-funded-projects__filter-select-native) {
  width: 100%;
  max-width:100%;
  box-sizing: border-box;
  height: var(--lsr-fp-control-h);
  max-height: var(--lsr-fp-control-h);
  padding: 0 2.25rem 0 0.85em;
  font-size: var(--lsr-fp-control-fs);
  line-height: var(--lsr-fp-control-lh);
  font-family: inherit;
  color: #0d0d0d !important;
  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 0;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23444' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.25L6 7.75L9.5 4.25'/%3E%3C/svg%3E");
  background-position: calc(100% - 12px) 50%;
  background-size: 12px 12px;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.lsr-funded-projects__filter select:not(.lsr-funded-projects__filter-select-native):hover {
  border-color: rgba(0,0,0,0.28);
  background-color: var(--lsr-beige-light, #f8f4ee);
  color: #0d0d0d !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.lsr-funded-projects__filter select:not(.lsr-funded-projects__filter-select-native):focus {
  outline: none;
  border-color: rgba(0,0,0,0.22);
  background-color: var(--lsr-beige-light, #f8f4ee);
  color: #0d0d0d !important;
  box-shadow: none;
}

.lsr-funded-projects__filter-select-native{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.lsr-funded-projects__custom-select{
  position:relative;
  width:100%;
  min-width:0;
  max-width:100%;
  /* Ei overflow:hidden — leikkaisi absoluuttisen .custom-select-panel -listan */
}

.lsr-funded-projects__custom-select-btn{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  flex-wrap:nowrap;
  gap:0.5rem;
  width:100%;
  max-width:100%;
  min-width:0;
  margin:0;
  height: var(--lsr-fp-control-h);
  min-height: var(--lsr-fp-control-h);
  max-height: var(--lsr-fp-control-h);
  padding: 0 2.25rem 0 0.85em;
  box-sizing: border-box;
  overflow:hidden !important;
  white-space:nowrap !important;
  font-size: var(--lsr-fp-control-fs);
  line-height: var(--lsr-fp-control-lh);
  font-family: inherit;
  text-align:left;
  /* Teema voi pakottaa valkoisen tekstin buttonille — tumma teksti riittävä kontrasti vaalealla */
  color: #0d0d0d !important;
  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 0;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23444' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.25L6 7.75L9.5 4.25'/%3E%3C/svg%3E");
  background-position: calc(100% - 12px) 50%;
  background-size: 12px 12px;
  background-repeat: no-repeat;
}

.lsr-funded-projects__custom-select-btn-label{
  display:block;
  min-width:0;
  flex:1 1 0;
  max-width:100%;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  word-break:normal !important;
  overflow-wrap:normal !important;
  text-align:left;
}

.lsr-funded-projects__custom-select-btn:hover{
  border-color: rgba(0,0,0,0.28);
  background-color: var(--lsr-beige-light, #f8f4ee);
  color: #0d0d0d !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.lsr-funded-projects__custom-select.is-open .lsr-funded-projects__custom-select-btn,
.lsr-funded-projects__custom-select-btn:focus{
  outline:none;
  border-color: rgba(0,0,0,0.22);
  background-color: var(--lsr-beige-light, #f8f4ee);
  color: #0d0d0d !important;
  box-shadow: none;
}

.lsr-funded-projects__custom-select-panel{
  position:absolute;
  left:0;
  top:calc(100% + 4px);
  z-index:100;
  margin:0;
  /* Nollaa teeman / UA:n listan padding (valkoinen raita reunassa) */
  padding:0 !important;
  padding-inline:0 !important;
  padding-block:0 !important;
  list-style:none outside none;
  list-style-type:none;
  box-sizing:border-box;
  min-width:100%;
  width:max-content;
  max-width:min(100vw - 1.5rem, 36rem);
  max-height:320px;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 0;
  background:#fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

.lsr-funded-projects__custom-select-option{
  display:block;
  margin:0 !important;
  margin-inline:0 !important;
  width:100%;
  max-width:none;
  box-sizing:border-box;
  padding:0.55rem 0.85rem;
  font-size:0.95rem;
  line-height:1.4;
  text-align:left;
  color: #0d0d0d !important;
  white-space:normal;
  word-break:normal;
  overflow-wrap:break-word;
  cursor:pointer;
  background-clip:border-box;
  transition: background .1s ease, color .1s ease;
}

.lsr-funded-projects__custom-select-option:hover,
.lsr-funded-projects__custom-select-option:focus{
  outline:none;
  background: var(--lsr-beige-light, #f8f4ee);
  color: #0d0d0d !important;
}

.lsr-funded-projects__custom-select-option[aria-selected="true"]{
  font-weight:600;
  background: var(--lsr-beige-light, #f8f4ee);
  color: #0d0d0d !important;
}

.lsr-funded-projects__filter-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:flex-end;
  flex:0 0 auto;
}

.lsr-funded-projects__filter-reset-row{
  flex:0 0 100%;
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  display:flex;
  justify-content:flex-end;
  align-items:center;
  padding-top:0.4rem;
  margin-top:0.15rem;
  border-top:1px solid rgba(0,0,0,0.08);
}

.lsr-funded-projects__submit {
  -webkit-appearance:none;
  appearance:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
  margin:0;
  height: var(--lsr-fp-control-h);
  min-height: var(--lsr-fp-control-h);
  max-height: var(--lsr-fp-control-h);
  padding: 0 1.35em;
  font-size:var(--lsr-fp-control-fs);
  line-height:var(--lsr-fp-control-lh);
  font-family:inherit;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space:nowrap;
  border:1px solid var(--lsr-berry-darker);
  border-radius: 0;
  background: var(--lsr-berry-darker);
  color: #fff;
  cursor: pointer;
  transition: opacity .2s ease;
}

.lsr-funded-projects__submit:hover {
  opacity: 0.8;
}

.lsr-funded-projects__reset{
  font-size: 0.85rem;
  opacity: 0.6;
  text-decoration: none;
}

.lsr-funded-projects__reset:hover{
  opacity: 1;
  text-decoration: underline;
}

.lsr-funded-projects__grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 18px;
}

.lsr-funded-project-card{
  display:block;
  padding:30px;
  border:0;
  border-radius:0;
  text-decoration:none;
  position:relative;
  background-color:var(--lsr-beige-light);
}
.lsr-funded-project-card__title{ margin:0 0 .5rem; }
.lsr-funded-project-card__thumb img{ width:100%; height:auto; border-radius:10px; }
.lsr-funded-project-card__excerpt{ margin:.75rem 0 1rem; opacity:.9; }
.lsr-funded-project-card__meta{
  font-size:.95rem;
  line-height:1.35;
  display:grid;
  gap:.35rem;
}
.lsr-funded-project-card__meta .project{
  font-size:1.25rem;
  font-weight:700 !important;
  max-width:90%;
}
.lsr-funded-project-card__meta .main-applicant{
  font-family:var(--main-font);
  font-size:0.85rem;
  font-weight:500;
  max-width:90%;
}
.lsr-funded-project-card__badge{
  position:absolute;
  top:12px;
  right:12px;
  font-size:.8rem;
  padding:.25rem .5rem;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.9);
}

.lsr-funded-projects a{
  color:#000;

}

.lsr-funded-projects a.arrow-link{
  text-transform:uppercase;
  font-weight:600;
  margin-top:20px;
  color:var(--lsr-blue);
  font-size:0.85rem;
}



.lsr-funded-projects .arrow-link::after {
  content: "→";
  margin-left: 4px;
  letter-spacing: 0.035em;
}

a.arrow-link + a.arrow-link {
    margin:6px 0;
}

.lsr-funded-projects__pagination{
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: 40px;
}

.lsr-funded-projects__pagination.gb-query-loop-pagination a.gb-button:hover{
  color:#fff;
}

.lsr-funded-projects__pagination.gb-query-loop-pagination .gb-button {
    display: inline-flex;
    padding: 15px 20px;
    text-decoration: none;
}

/* Wide: grid — yksi rivi (5 + nappi), pitkä valinta kutistuu (ellipsis); reset omalla rivillä ilman flex-wrap-ongelmaa */
@media (min-width: 1100px){
  .lsr-funded-projects__filters-inner{
    display:grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
    align-items:end;
    gap:0.65rem 0.85rem;
  }
  .lsr-funded-projects__filter{
    min-width:0;
    max-width:100%;
  }
  .lsr-funded-projects__filter-actions{
    grid-column:6;
    justify-self:start;
  }
  .lsr-funded-projects__filter-reset-row{
    grid-column:1 / -1;
    grid-row:2;
  }
}

@media (max-width: 640px){
  .lsr-funded-projects__filter{
    flex:1 1 100%;
    min-width:0;
    width:100%;
  }
  .lsr-funded-projects__filter-actions{
    width:100%;
    justify-content:flex-start;
  }
  .lsr-funded-projects__submit{
    flex:1 1 auto;
    text-align:center;
  }
  .lsr-funded-projects__filter-reset-row{
    justify-content:flex-start;
  }
}


/* ---------------------------------
   Project & donor stories
---------------------------------- */

.project-story-content-area{
  max-width:1060px;
  margin: 0 auto 80px auto;
}

.type-lsr_project h1{
  font-size:42px;
}

.project-story-title{
  margin:30px 0 60px 0;
}

.project-story-title h1{
  color:var(--lsr-blue);
}

.project-story-title time{
  font-weight:600;
}

.project-story-featured{
  text-align:center;
  margin: 60px auto !important;
  aspect-ratio:16/9 !important;
  overflow:hidden;
  display:flex;
}

.project-story-featured img{
  object-fit: cover;
  object-position: center center;
}

.project-story-excerpt{
  padding:10px 40px 40px 40px;
  background-color:var(--lsr-beige-light);
  margin-bottom:30px;
}

.project-story-excerpt h2{
  text-transform:uppercase;
  font-size:1rem !important;
  color:#000 !important;
}

.project-story-hero-without-image + .project-story-content {
  margin:40px 0;
  max-width:1180px;
}


/* ---------------------------------
   Project / Donor facts & sidebar
---------------------------------- */

.lsr-donor-facts{
  margin:0;
}

.lsr-donor-facts__title{
  font-weight:700;
  letter-spacing:.02em;
  margin:0 0 6px 0;
  color:#000 !important;
  text-transform:uppercase;
  font-size:22px;
}

.lsr-donor-facts__desc{
  margin:0 0 2rem;
}

.lsr-donor-facts__desc p{
  line-height:1.5;
}

.lsr-donor-facts__meta div{
  margin-bottom:.5rem;
}

.lsr-donor-facts__meta dt,
.lsr-donor-facts__meta dd{
  display:inline;
  margin:0;
}

.lsr-donor-facts__meta dt{
  font-weight:800;
  text-transform:uppercase;
}

.lsr-donor-facts__meta dt::after{
  content:": ";
}

.lsr-project-facts,
.lsr-donor-facts {
  line-height:1.2;
}

.lsr-project-facts__row--name .lsr-project-facts__dd{
  font-style:oblique;
}


.project-donor-wrapper .page-content > .gb-grid-wrapper{
  gap:20px;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
}

.project-donor-wrapper .page-content > .gb-grid-wrapper > .gb-grid-column {
  display: flex;
  min-width: 0;
}

.project-donor-sidebar{
  background-color:var(--lsr-beige-light);
  padding:30px;
  margin:0;
  text-align:left;
  width:100%;
  border: 2px solid var(--lsr-beige-light);
}

.project-donor-sidebar:has(.lsr-donor-facts){
  background-color:transparent;
  text-align:center;
}

.project-donor-sidebar .lsr-donor-facts__title,
.project-donor-sidebar .lsr-donor-facts__desc{
  display:none;
}

.project-donor-sidebar .lsr-project-facts h3{
  text-transform:uppercase;
  font-size:22px;
}

.project-donor-info{
  border: 0 solid var(--lsr-beige-light);
  padding: 0;
  width: 100%;
  text-align: left;
}

@media (max-width: 990px) {
  .project-donor-wrapper{
    text-align:center;
    width:100%;
    padding:0 20px;
  }
  .project-donor-wrapper .page-content > .gb-grid-wrapper {
    flex-wrap: wrap;
    margin:0 auto;
    width:100%;
  }
}


/* ---------------------------------
   Related articles
---------------------------------- */

h2.lsr-related-articles__title{
  font-size:32px;
  color:var(--lsr-blue);
}

.lsr-related-articles__list {
  list-style: none;
  margin: 0 0 60px 0;
  padding: 0 !important;
  display: grid;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .lsr-related-articles__list {
    grid-template-columns: 1fr;
    margin:0 10px;
  }
}

@media (min-width: 769px) and (max-width: 1279px) {
  .lsr-related-articles__list {
    grid-template-columns: repeat(2, 1fr);
    margin:0 20px;
  }
}

@media (min-width: 1280px) {
  .lsr-related-articles__list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.lsr-related-articles__item {
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lsr-related-articles__item h3{
  line-height:1;
}

.lsr-related-articles__item h3 a{
  font-size:24px;
  text-wrap:balance;
}

.lsr-related-articles__thumb{
  aspect-ratio:3/2;
  overflow:hidden;
}

.lsr-related-articles__thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.lsr-related-articles__content {
  padding: 0.75rem 0;
  flex-grow: 1;
}

.lsr-related-articles__thumb:not(:has(.lsr-related-articles__image)) {
  display: block;
  width: 100%;
  padding-top: 66.6667%;
  background: url('../images/placeholder.png') center/cover no-repeat;
  position: relative;
}
.lsr-related-articles__thumb:has(.lsr-related-articles__image) {
  background: none;
  padding-top: 0;
}
.lsr-related-articles__thumb.thumb--no-image {
  display: block;
  width: 100%;
  padding-top: 66.6667%;
  background: url('../images/placeholder.png') center/cover no-repeat;
  position: relative;
}
.lsr-related-articles__thumb.thumb--no-image .lsr-related-articles__image {
  background: none;
  padding-top: 0;
}


/* ---------------------------------
   Category-specific tweaks
---------------------------------- */

.category-lahjoitustarinat .dynamic-featured-image{
  margin-top:20px;
}

.category-lahjoitustarinat .query-loop-container figure.gb-block-image img,
.category-hanketarinat .query-loop-container figure.gb-block-image img{
  object-fit:cover;
}


/* ---------------------------------
   Funds / descriptions
---------------------------------- */

.ingressi:has(.lsr-fund-description){
  margin: 0 0 30px 0;
}

.lsr-fund-description p{
  margin:0 0 30px 0 !important;
}

