p {
  font-family: "Hepta Slab", system-ui, sans-serif;
}


.pesti-section { margin: 2rem auto; padding: 0 1rem;}
.pesti-category {
  font-family: "Expletus Sans", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: var(--color-Yösininen);
  margin: 2rem 0 0.75rem;
}

/* Grid */
.pesti-grid{
  display: grid;
  gap: 24px;                     /* card gap */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: start;            /* don’t stretch card height */
  justify-items: stretch;        /* cards fill their grid cell */
}

.pesti-item { width: 100%; }

/* Card (title only) */
.pesti-card {
  all: unset;                 /* reset link/button defaults */
  display: block;
  padding: 1rem 1rem;
  min-height: 98px;
  width: 90%;
  white-space: normal;
  display: -webkit-box;                /* enable line clamp */
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;               /* show up to 2 lines */
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  hyphens: auto;
  border-radius: 16px;
  background: #2B6B80;
  font-family: "Hepta Slab", serif;
  font-weight: 600;
  font-size: clamp(18px, 4vw, 24px);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0,0,0,.12);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

/* Make cards ready for background images */
.pesti-card {
  position: relative;
  overflow: hidden;
  color: #0F262B; /* white text works best on photos */
}

/* Taso-specific backgrounds */
.pesti-card.taso-paallikko {
  background: #1b5160;
  background-image:
    url("Images/Vaiski26_Punainen_Huomaamaton_JPG.jpg");
  background-size: 400%;
  background-position: center;
}

.pesti-card.taso-asiantuntija {
  background: #275f4a;
  background-image:
    url("Images/Vaiski26_Turkoosi_Huomaamaton_JPG.jpg");
  background-size: 400%;
  background-position: center;
}

.pesti-card.taso-mestari {
  background: #654a1f;
  background-image:
    url("Images/Vaiski26_Sininen_Huomaamaton_JPG.jpg");
  background-size: 400%;
  background-position: center;
}

.pesti-card.taso-tekija {
  background: #5a2a4e;
  background-image:
    url("Images/Vaiski26_Keltainen_Huomaamaton_JPG.jpg");
  background-size: 400%;
  background-position: center;
}
.pesti-card:hover { transform: translateY(-2px); box-shadow: 0 12px 22px rgba(0,0,0,.2); }
.pesti-card:focus-visible { outline: 3px solid #C54D5D; outline-offset: 3px; }

/* Modal */
.pesti-modal { 
  position: fixed; inset: 0; z-index: 3000; 
  display: none;
}
.pesti-modal.is-open { display: block; }
.pesti-modal__overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
}
.pesti-modal__dialog {
  font-family: 'Hepta Slab';
  position: relative;
  max-width: min(1000px, 80vw);
  max-height: min(88vh, 1000px);
  margin: 6vh auto;
  background: var(--color-LuonnonValkoinen);
  color: #24353a;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  overflow: auto;
  padding: clamp(16px, 2.4vw, 28px);
}

.pesti-modal .pesti-subhead{
  margin: 1 0 .35rem 0;
  color: var(--color-SininenTumma);
  font-weight: 700;
  line-height: 1.2;
  font-size: 1rem;
}

/* Larger for the two “major” subheads */
.pesti-modal .pesti-subhead--major{
  font-size: 1.4rem;
}



#pestiModalTitle,
.pesti-header h3 {
    transform: translateY(-15px);
  margin: 0 0 .8rem;
  line-height: 1.2;
  overflow-wrap: anywhere;   /* modern wrap */
  word-break: break-word;    /* fallback */
  hyphens: auto;             /* hyphenate when available */
  margin-right: 5rem;      /* extra clearance toward the ✕ */
  padding-right: 40px;
}
.pesti-modal__close {
  position: sticky; top: 0; left: 100%;
  transform: translate(-8px, 8px);
  border: none; background: var(--color-SininenTumma); color: var(--color-LuonnonValkoinen);
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer;
  z-index: 1;
}
#pestiModalTitle {
  font-family: "Expletus Sans", system-ui, sans-serif;
  font-size: clamp(1.4rem, 3.6vw, 2rem);
  margin: 0 0 .5rem 0;

}
.pesti-modal__content { line-height: 1.6; }
.pesti-header .pesti-meta { 
  list-style: none; padding: 0; margin: .5rem 0 1rem 0;
}
.pesti-header .pesti-meta li + li { margin-top: .35rem; }
.pesti-section-block { margin: 1rem 0; }
.pesti-section-block h4 { margin: 0 0 .25rem 0; font-size: 1rem; color: var(--color-Yösininen); }
.pesti-contacts { margin: .5rem 0 0; padding-left: 1rem; }
.pesti-contacts li { margin: .25rem 0; }

/* Lock background scroll when modal open */
body.pesti-modal-open { overflow: hidden; }

/* small gap under the modal title */


/* arrow buttons that sit outside the dialog */
.pesti-modal__arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--color-LuonnonValkoinen);
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  cursor: pointer;
  z-index: 2002;               /* above overlay & dialog edges */
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 26px;              /* the ‹ › glyph size */
  line-height: 1;
}

.pesti-modal__prev { left: clamp(8px, 2vw, 16px); }
.pesti-modal__next { right: clamp(8px, 2vw, 16px); }

html { scroll-behavior: smooth; }

.pesti-category { scroll-margin-top: 130px; }

.pesti-cta-wrap {
  margin-top: clamp(16px, 2.2vw, 28px);
}

.pesti-cta {
  display: inline-block;
  background: var(--color-SininenTumma);          /* blue */
  color: var(--color-LuonnonValkoinen);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 14px 22px;
  border-radius: 12px;
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease;
}

.pesti-cta:active {
  transform: translateY(1px);
}

.pesti-cta:focus-visible {
  outline: 3px solid #94c5f1;
  outline-offset: 3px;
  border-radius: 14px;
}

.pesti-modal__content h4 { 
  font-family: 'Hepta Slab';
  margin: 1rem 0 .25rem; font-size: 1rem; color: var(--color-SininenTumma); }
.pesti-modal__content p  { margin: .25rem 0; }
/* Collapsible category heading */
.pesti-category{
  display: flex;
  align-items: center;
  margin: 2rem 0 .75rem; /* keep your existing spacing */
}

/* The clickable header (inside h2) */
.pesti-toggle{
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

/* Small triangle caret */
.pesti-caret{
  width: 0; height: 0;
  border: 6px solid transparent;
  border-left-color: currentColor;      /* ► */
  transform: rotate(90deg);             /* ▼ when open */
  transition: transform .18s ease;
}

/* Rotate caret when collapsed */
.pesti-toggle[aria-expanded="false"] .pesti-caret{ transform: rotate(0deg); }

/* Panel is hidden when [hidden] attribute is set */
.pesti-panel[hidden]{ display: none; }


/* smaller on very small screens (hide if you want) */
@media (max-width: 700px){
  .pesti-modal__content p  {font-size: 14px;}
  .pesti-grid{
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
  .pesti-modal__arrow{ width: 36px; height: 36px; font-size: 22px; }
}