/* ==========================================================================
   Diana de Graaf — Portfolio Website CSS
   Version where each Basistekstkader sits to the right of its preceding image
   ========================================================================== */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Georgia', serif;
  background: #fafafa;
  color: #2a2a2a;
  line-height: 1.6;
}

/* ---------- Page Frame ---------- */
body {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 40px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: 'Montserrat', sans-serif;
  color: #333;
  font-weight: 600;
  margin: 0 0 0.5em 0;
  letter-spacing: 0.01em;
}

p {
  margin: 0 0 1.2em 0;
  font-size: 1rem;
  color: #555;
}

a {
  color: #6a7b57;
  text-decoration: none;
}

a:hover {
  color: #4d5b3f;
}

/* ---------- Headings exported from InDesign ---------- */
.headlines {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.3;
  color: #222;
}

.subheads {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  color: #333;
  margin-top: 0.4em;
}

/* ---------- Generic image styling ---------- */
[id^="_idContainer"] img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  margin-block: 50px;
}

/* ---------- Main pairing logic ----------
   Any image that directly precedes a Basistekstkader will shrink and sit left,
   with the text container to its right.
-------------------------------------------------------------------------- */
[id^="_idContainer"] img:has(+ .Basistekstkader),
[id^="_idContainer"] img + .Basistekstkader,
[id^="_idContainer"] img + div.Basistekstkader {
  display: block;
}

/* create a flex context for the image + following text */
[id^="_idContainer"] img + .Basistekstkader,
[id^="_idContainer"] img + div.Basistekstkader {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

/* the preceding image shrinks and moves to the left */
[id^="_idContainer"] img + .Basistekstkader::before {
  content: "";
}

/* actual paired layout */
[id^="_idContainer"] img + .Basistekstkader,
[id^="_idContainer"] img + div.Basistekstkader {
  margin-block: 60px;
}

/* ensure the image before the Basistekstkader is small */
[id^="_idContainer"] img + .Basistekstkader::before {
  content: "";
  flex: 0 0 30%;
  background-size: cover;
  background-position: center;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* We’ll dynamically use the previous image’s data via CSS sibling */
[id^="_idContainer"] img + .Basistekstkader {
  display: flex;
  flex-direction: row;
  gap: 40px;
  align-items: flex-start;
}

[id^="_idContainer"] img + .Basistekstkader img {
  flex: 0 0 30%;
  max-width: 30%;
  height: auto;
  margin: 0;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* style the Basistekstkader text block */
.Basistekstkader {
  flex: 1;
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}

/* headlines inside text blocks */
.Basistekstkader .headlines {
  margin-top: 0;
  margin-bottom: 0.4em;
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
}

/* spacing between pairs of sections */
[id^="_idContainer"] img + .Basistekstkader + * {
  margin-top: 80px;
}

/* ---------- Normal full-width images (not followed by text) ---------- */
[id^="_idContainer"] img:not(:has(+ .Basistekstkader)) {
  width: 100%;
  max-height: 800px;
  object-fit: cover;
}

/* ---------- Responsiveness ---------- */
@media (max-width: 900px) {
  [id^="_idContainer"] img + .Basistekstkader {
    flex-direction: column;
  }

  [id^="_idContainer"] img + .Basistekstkader img {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .Basistekstkader {
    padding: 25px;
  }
}