/* Nordiska Takbehandlingar - reference pages: /referenser (case grid) and /referenser/<case>.
   Linked after site.css. Sizes measured from the Framer pages at 390 / 1024 / 1440 px
   (Framer page modules "Referenser" index + collection page, Blog Card component). */

:root {
  --ref-card-bg: #f0f4fa;           /* Blog Card fill, only visible at the rounded edge */
  --ref-overlay: rgba(0, 0, 0, 0.4); /* card hover veil */
  --ref-rule: #f9f9f9;              /* the divider above the galleries (Framer token "Background") */
  --ref-black: #000000;             /* card titles */
  --ref-lightbox: rgba(0, 0, 0, 0.8);
  --f-card: "Figtree", "Helvetica Neue", sans-serif;
  --r-ref-card: 10px;
  --r-ref-media: 15px;
  --r-ref-shot: 24px;
}

/* ================= /referenser: the case grid ================= */
.ref-index {
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 50px;
  padding: 175px 0 0;
}
.ref-index__title {
  width: 90%;
  font-family: var(--f-display); font-weight: 400; color: var(--ink);
  font-size: 56px; line-height: 1.05; letter-spacing: -0.04em; text-align: center;
}
.ref-grid {
  width: 80%;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); grid-auto-rows: min-content;
  gap: 40px; justify-content: center;
}
.ref-grid > li { justify-self: start; align-self: start; width: fit-content; }

.ref-card {
  position: relative; display: flex; flex-direction: column;
  width: 287px; height: 412px; overflow: hidden;
  border-radius: var(--r-ref-card); background: var(--ref-card-bg);
  transition: transform var(--t-fast) var(--ease-out);
}
/* fixed photo height so every card row lines up; the text panel takes the slack (Framer let the photo
   absorb it, which stepped the rows once 44 cases mixed titles with and without text) */
.ref-card__media { position: relative; flex: none; height: 203px; width: 100%; overflow: hidden; }
.ref-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ref-card__overlay {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--ref-overlay); opacity: 0;
  transition: opacity 0.35s var(--ease-out);
}
.ref-card__overlay svg { width: 60px; height: 60px; fill: var(--white); }
.ref-card:hover .ref-card__overlay, .ref-card:focus-visible .ref-card__overlay { opacity: 1; }
.ref-card:active { transform: scale(0.99); }
.ref-card:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: var(--r-ref-card); }

.ref-card__text {
  flex: 1 0 0; width: 100%; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 15px;
  padding: 30px; background: var(--cream);
}
.ref-card__title {
  width: 100%;
  font-family: var(--f-card); font-weight: 600; font-size: 22px; line-height: 1.4; letter-spacing: 0;
  color: var(--ref-black);
}
.ref-card__excerpt {
  width: 227px; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1;
  font-family: var(--f-display); font-weight: 500; font-size: 18px; line-height: 27px; letter-spacing: -0.01em;
  color: var(--ink);
}
.ref-card__excerpt p + p { margin-top: 20px; } /* clipped by the clamp; Framer's paragraph spacing */
.ref-card__more {
  width: 100%;
  font-family: var(--f-card); font-weight: 600; font-size: 16px; line-height: 1.9; letter-spacing: 0;
  color: var(--green-dark);
}
/* Framer keeps the empty excerpt box (and its 15 px gap) on cards without text */
.ref-card__text--short .ref-card__more { margin-top: 15px; }

@media (max-width: 1199.98px) {
  .ref-index { padding: 175px 24px 0; }
  .ref-grid { grid-template-columns: repeat(2, minmax(250px, 1fr)); gap: 30px; }
}
@media (max-width: 809.98px) {
  .ref-index { padding: 175px 16px 0; }
  .ref-index__title { font-size: 38px; }
  .ref-grid { display: flex; flex-direction: column; align-items: center; gap: 40px; }
  .ref-grid > li { width: auto; }
}

/* ================= /referenser/<case> ================= */
.ref-case { width: 100%; display: flex; justify-content: center; padding: 175px 125px 0; overflow-x: clip; }
/* overflow-x: clip keeps the 560 px divider (wider than a phone, as in Framer) from widening the page */
.ref-case__inner { width: 100%; max-width: var(--content); display: flex; flex-direction: column; align-items: flex-start; }

/* photo + text */
.ref-case__top { width: 100%; display: flex; align-items: center; justify-content: center; gap: 22px; }
.ref-case__media {
  flex: none; width: 508px; height: 348px; overflow: hidden;
  border-radius: var(--r-ref-media);
}
.ref-case__media img { width: 100%; height: 100%; object-fit: cover; }
.ref-case__text {
  flex: 1 0 0; width: 1px; max-width: 440px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 32px;
}
.ref-case__text > h1 { width: 100%; }
.ref-case__body { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 24px; }
.ref-case__copy { width: 100%; }
.ref-case__copy p + p { margin-top: 20px; }
/* a case without text: Framer keeps the empty text box, so the button still sits 24 px lower */
.ref-case__body--nocopy .btn { margin-top: 24px; }

/* divider: Framer's 951 px svg line, 2 px stroke centred on a 1 px box */
.ref-case__rule { flex: none; width: 950px; max-width: none; padding: 30px 0; }
.ref-case__rule > div { position: relative; width: 951px; height: 1px; }
.ref-case__rule > div::before {
  content: ""; position: absolute; left: 0; top: -1px; width: 100%; height: 2px; background: var(--ref-rule);
}

/* Före / Färdigt resultat */
.ref-case__galleries { width: 100%; display: flex; align-items: flex-start; justify-content: center; gap: 22px; }
/* flex-start: both headings sit on one line when the galleries differ in length (Framer centred them) */
.ref-gallery { flex: 1 0 0; width: 1px; display: flex; flex-direction: column; align-items: flex-start; gap: 32px; }
.ref-case__galleries--single { justify-content: flex-start; }
.ref-case__galleries--single .ref-gallery { flex: 0 0 calc((100% - 22px) / 2); }
html.js .ref-gallery[data-reveal] { --reveal-y: 50px; }
/* Framer's appear spring here (damping 80, stiffness 250, mass 1): 95 % at 0.94 s, settled by 1.4 s */
html.js .ref-case [data-reveal] { --reveal-dur: 1.4s; --reveal-ease: cubic-bezier(0.2, 0.7, 0.3, 1); }
.ref-gallery__grid { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: min-content; gap: 10px; }
.ref-shot {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: var(--r-ref-shot); cursor: cell;
}
.ref-shot img { width: 100%; height: 100%; object-fit: cover; transition: opacity var(--t-fast) var(--ease-out); }
/* a gallery with one picture shows it across the gallery's width, not as a lone tile beside a gap */
.ref-gallery__grid > li:only-child { grid-column: 1 / -1; }
.ref-gallery__grid > li:only-child .ref-shot { aspect-ratio: 4 / 3; }
.ref-shot:hover img { opacity: 0.92; }
.ref-shot:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: var(--r-ref-shot); }

@media (max-width: 1199.98px) {
  .ref-case__top { flex-direction: column; gap: 0; }
  .ref-case__media { height: 344px; }
  .ref-case__text { flex: none; width: 100%; gap: 20px; padding-top: 20px; }
  .ref-case__rule { width: 560px; overflow: hidden; }
  .ref-case__galleries { flex-direction: column; }
  .ref-gallery, .ref-case__galleries--single .ref-gallery { flex: none; width: 100%; }
}
@media (max-width: 809.98px) {
  .ref-case { padding: 175px 16px 0; }
  .ref-case__media { width: 357px; max-width: 100%; height: 247px; }
}

/* ================= Fler referenser: three related cases + the service page, under every case ================= */
.ref-more { width: 100%; display: flex; justify-content: center; padding: 0 125px; margin-top: -40px; }
.ref-more__inner { width: 100%; max-width: var(--content); display: flex; flex-direction: column; align-items: flex-start; gap: 40px; }
.ref-more__grid { width: 100%; grid-template-columns: repeat(3, 287px); justify-content: start; }
.ref-more__links { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
@media (max-width: 1199.98px) {
  .ref-more { padding: 0 24px; margin-top: -30px; }
  .ref-more__grid { grid-template-columns: repeat(2, 287px); }
  .ref-more__grid > li:nth-child(3) { display: none; }
}
@media (max-width: 809.98px) {
  .ref-more { padding: 0 16px; margin-top: -20px; }
  .ref-more__inner { align-items: center; text-align: center; }
  .ref-more__links { justify-content: center; }
}

/* ================= lightbox (Framer overlay: click a photo, click anywhere or Esc to close) ================= */
.ref-lb { position: fixed; inset: 0; z-index: 45; }   /* under the nav (z 50), as in Framer */
.ref-lb__veil {
  position: absolute; inset: 0; background: var(--ref-lightbox); opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.5, 0, 0.88, 0.77);
}
.ref-lb__img {
  position: fixed; left: 49.8333%; top: 54.6477%; display: block; padding: 0; cursor: zoom-out;
  transform: translate(-50%, -50%) scale(0.5); opacity: 0;
  transition: transform 0.4s cubic-bezier(0.25, 1.12, 0.5, 1), opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.ref-lb__img img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-ref-shot); }
.ref-lb__img:focus-visible { outline: none; }
.ref-lb__img:focus-visible img { outline: 2px solid var(--white); outline-offset: 3px; }
.ref-lb.is-open .ref-lb__veil { opacity: 1; }
.ref-lb.is-open .ref-lb__img { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ref-lb.is-closing .ref-lb__veil { transition: opacity 0.2s cubic-bezier(0.12, 0.23, 0.5, 1); }

@media (prefers-reduced-motion: reduce) {
  .ref-card, .ref-card__overlay, .ref-shot img, .ref-lb__veil, .ref-lb__img { transition: none !important; }
}
