/* ── Atamer portfolio booklet (modal) ── */

:root {
  --bk-espresso: #311B14;
  --bk-wood: #4B3625;
  --bk-warm: #D7CBBE;
  --bk-cream: #F8F4ED;
  --bk-white: #FFFFFF;
  --bk-pad: 5.5%;
  --bk-photo-inset: 1.75%;
  --bk-font: "Montserrat", system-ui, sans-serif;
  --bk-page-ratio: 297 / 210;
  --bk-nav-space: 6.5rem;
  --bk-modal-gutter: 1.5rem;
  --bk-max-book-w: 960px;
  --bk-book-w: min(
    calc(100vw - var(--bk-modal-gutter) - var(--bk-nav-space)),
    var(--bk-max-book-w),
    calc((88vh - 6rem) * 297 / 210)
  );
}

body.boekje-modal-open {
  overflow: hidden;
}

/* ── Modal shell ── */
.boekje-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.boekje-modal[hidden] {
  display: none;
}

.boekje-modal__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bk-espresso) 78%, transparent);
  backdrop-filter: blur(6px);
}

.boekje-modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(calc(var(--bk-book-w) + var(--bk-nav-space)), calc(100vw - var(--bk-modal-gutter)));
  max-height: 98vh;
  background: color-mix(in srgb, var(--bk-cream) 92%, var(--bk-warm));
  border-radius: 6px;
  box-shadow:
    0 28px 80px rgba(49, 27, 20, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  overflow: hidden;
}

.boekje-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--bk-espresso);
  color: var(--bk-cream);
}

.boekje-modal__label {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.boekje-modal__counter {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
}

.boekje-modal__header-actions {
  display: flex;
  gap: 0.375rem;
}

.boekje-modal__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: transparent;
  color: var(--bk-cream);
  font-size: 1.375rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.boekje-modal__icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.4);
}

.boekje-modal__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 3rem 0.625rem;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.boekje-modal__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--bk-wood) 25%, transparent);
  border-radius: 50%;
  background: var(--bk-white);
  color: var(--bk-espresso);
  font-size: 1rem;
  cursor: pointer;
  transform: translateY(-50%);
  box-shadow: 0 4px 16px rgba(49, 27, 20, 0.12);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.boekje-modal__nav--prev {
  left: 0.5rem;
}

.boekje-modal__nav--next {
  right: 0.5rem;
}

.boekje-modal__nav:hover:not(:disabled) {
  background: var(--bk-cream);
  transform: translateY(calc(-50% - 1px));
  box-shadow: 0 6px 20px rgba(49, 27, 20, 0.16);
}

.boekje-modal__nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.boekje-modal__book {
  position: relative;
  width: min(100%, var(--bk-book-w));
  max-width: var(--bk-book-w);
  min-width: 0;
  margin: 0 auto;
  padding: 0.55rem 0.75rem 0.55rem 0.95rem;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--bk-wood) 88%, #000) 0%,
    color-mix(in srgb, var(--bk-espresso) 92%, #000) 100%
  );
  border-radius: 4px 8px 8px 4px;
  box-shadow:
    0 18px 40px rgba(49, 27, 20, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.boekje-modal__spine {
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  left: 0.35rem;
  width: 0.55rem;
  border-radius: 2px 0 0 2px;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(255, 255, 255, 0.06) 45%,
    rgba(0, 0, 0, 0.2) 100%
  );
  pointer-events: none;
}

.boekje-modal__viewport {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: var(--bk-page-ratio);
  background: var(--bk-white);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(49, 27, 20, 0.08),
    2px 0 8px rgba(49, 27, 20, 0.12);
  overflow: hidden;
}

.boekje-modal__footer {
  padding: 0.5rem 1rem 0.625rem;
  text-align: center;
  border-top: 1px solid color-mix(in srgb, var(--bk-warm) 70%, transparent);
}

.boekje-modal__footer p {
  margin: 0;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--bk-wood) 70%, var(--bk-espresso));
}

.boekje-modal__error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 1.5rem;
  font-size: 0.875rem;
  text-align: center;
  color: var(--bk-wood);
}

/* ── Pages ── */
.boekje__page {
  overflow: hidden;
  font-family: var(--bk-font);
  color: var(--bk-espresso);
  -webkit-font-smoothing: antialiased;
}

.boekje-modal__viewport .boekje__page {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.boekje-modal__viewport .boekje__page.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

/* ── Cover ── */
.bk-cover {
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100%;
  padding: var(--bk-pad);
  background: var(--bk-espresso);
  color: var(--bk-cream);
}

.bk-cover__top {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
}

.bk-cover__logo {
  height: clamp(1.5rem, 5vw, 2rem);
  width: auto;
}

.bk-cover__title {
  margin: 0;
  font-size: clamp(1.35rem, 4.8vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.02;
  max-width: 12ch;
  color: var(--bk-white);
}

.bk-cover__subtitle {
  margin: 0.75rem 0 0;
  font-size: clamp(0.75rem, 2.4vw, 0.875rem);
  font-weight: 400;
  line-height: 1.6;
  max-width: 28ch;
  color: rgba(255, 255, 255, 0.72);
}

.bk-cover__footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

/* ── Intro ── */
.bk-intro,
.bk-chapter {
  min-height: 0;
  min-width: 0;
}

.bk-intro {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  height: 100%;
  background: var(--bk-cream);
}

.bk-intro__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--bk-pad);
}

.bk-intro__eyebrow {
  margin-bottom: 0.75rem;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bk-wood);
}

.bk-intro__title {
  margin: 0;
  font-size: clamp(1rem, 3.2vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 14ch;
}

.bk-intro__lead {
  margin: 0.875rem 0 0;
  font-size: clamp(0.6875rem, 2vw, 0.8125rem);
  line-height: 1.65;
  color: color-mix(in srgb, var(--bk-wood) 80%, var(--bk-espresso));
  max-width: 32ch;
}

.bk-intro__visual {
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  background: var(--bk-white);
}

.bk-intro__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ── Chapter opener ── */
.bk-chapter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
}

.bk-chapter--dark {
  background: var(--bk-espresso);
  color: var(--bk-cream);
}

.bk-chapter--light {
  background: var(--bk-white);
}

.bk-chapter__copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--bk-pad);
}

.bk-chapter__num {
  margin-bottom: 0.75rem;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: color-mix(in srgb, var(--bk-warm) 70%, transparent);
}

.bk-chapter--light .bk-chapter__num {
  color: color-mix(in srgb, var(--bk-wood) 55%, transparent);
}

.bk-chapter__title {
  margin: 0;
  font-size: clamp(1.15rem, 3.8vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.bk-chapter__lead {
  margin: 0.625rem 0 0;
  font-size: clamp(0.6875rem, 2vw, 0.8125rem);
  line-height: 1.6;
  max-width: 28ch;
  color: rgba(255, 255, 255, 0.68);
}

.bk-chapter--light .bk-chapter__lead {
  color: color-mix(in srgb, var(--bk-wood) 75%, var(--bk-espresso));
}

.bk-chapter__visual {
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  background: color-mix(in srgb, var(--bk-cream) 65%, var(--bk-white));
}

.bk-chapter__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ── Photo spreads ── */
.bk-spread {
  display: grid;
  height: 100%;
  min-height: 0;
  padding: var(--bk-photo-inset);
  background: var(--bk-cream);
  gap: 2.5%;
}

.bk-spread--full {
  grid-template: 1fr / 1fr;
}

.bk-spread--full img {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: cover;
  object-position: center;
  background: var(--bk-white);
}

.bk-spread--duo {
  grid-template-columns: 1fr 1fr;
}

.bk-spread--duo img {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: cover;
  object-position: center;
  background: var(--bk-white);
}

.boekje-modal__viewport .bk-spread {
  padding: 1.5%;
  gap: 1.5%;
}

.bk-spread--hero {
  grid-template-columns: 1.25fr 0.75fr;
}

.bk-spread--hero img {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: cover;
  object-position: center;
  background: var(--bk-white);
}

.bk-spread--stack {
  grid-template-rows: 1.15fr 0.85fr;
}

.bk-spread--stack img {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: cover;
  object-position: center;
  background: var(--bk-white);
}

.bk-spread--captioned {
  position: relative;
}

.bk-spread__caption {
  position: absolute;
  left: calc(var(--bk-photo-inset) + 4%);
  bottom: calc(var(--bk-photo-inset) + 3%);
  max-width: 16rem;
  padding: 0;
  margin: 0;
  z-index: 1;
}

.bk-spread__tag {
  display: block;
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.bk-spread__desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.625rem;
  font-weight: 400;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.88);
}

.bk-spread--captioned::after {
  content: "";
  position: absolute;
  inset: var(--bk-photo-inset);
  background: linear-gradient(to top, rgba(49, 27, 20, 0.5) 0%, transparent 38%);
  pointer-events: none;
}

/* ── Back cover ── */
.bk-back {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: var(--bk-pad);
  background: var(--bk-espresso);
  color: var(--bk-cream);
}

.bk-back__logo {
  height: clamp(1.35rem, 4vw, 1.75rem);
  width: auto;
}

.bk-back__title {
  margin: 0;
  font-size: clamp(1.1rem, 3.2vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  max-width: 16ch;
  color: var(--bk-white);
}

.bk-back__contact {
  display: grid;
  gap: 0.25rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  line-height: 1.55;
}

.bk-back__contact a {
  color: var(--bk-cream);
  text-decoration: none;
}

.bk-back__contact a:hover {
  color: var(--bk-white);
}

.bk-back__footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.5625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

/* ── Open button on main page ── */
.projecten-intro__actions {
  margin-top: 1.5rem;
}

.projecten-intro__boekje-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.projecten-intro__boekje-btn svg {
  flex-shrink: 0;
}

@media (max-width: 767px) {
  :root {
    --bk-nav-space: 5.5rem;
    --bk-modal-gutter: 1rem;
    --bk-max-book-w: 100%;
    --bk-book-w: min(
      calc(100vw - var(--bk-modal-gutter) - var(--bk-nav-space)),
      calc((92vh - 5.5rem) * 297 / 210)
    );
    --bk-pad: 5%;
    --bk-photo-inset: 1.5%;
  }

  .boekje-modal__panel {
    width: calc(100vw - var(--bk-modal-gutter));
    max-height: 96vh;
  }

  .boekje-modal__stage {
    padding: 0.625rem 2.75rem 0.5rem;
  }

  .boekje-modal__nav {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.875rem;
  }

  .boekje-modal__nav--prev {
    left: 0.375rem;
  }

  .boekje-modal__nav--next {
    right: 0.375rem;
  }

  .boekje-modal__book {
    padding: 0.45rem 0.55rem 0.45rem 0.8rem;
  }

  .bk-intro,
  .bk-chapter {
    grid-template-columns: 1fr 1fr;
  }

  .bk-chapter__copy,
  .bk-intro__copy {
    padding: 5%;
  }

  .bk-intro__title,
  .bk-chapter__title {
    font-size: clamp(0.85rem, 3.2vw, 1.1rem);
  }

  .bk-intro__lead,
  .bk-chapter__lead {
    font-size: 0.625rem;
  }
}

/* ── Standalone print page (boekje.html) ── */
.boekje-standalone {
  font-family: var(--bk-font);
  margin: 0;
  color: var(--bk-espresso);
  background: #e8e2da;
}

.boekje-standalone .boekje-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  background: var(--bk-espresso);
  color: var(--bk-cream);
  font-size: 0.8125rem;
}

.boekje-standalone .boekje-toolbar a {
  color: var(--bk-cream);
  text-decoration: none;
}

.boekje-standalone .boekje-toolbar__actions {
  display: flex;
  gap: 0.75rem;
}

.boekje-standalone .boekje-toolbar__btn {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: var(--bk-cream);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.boekje-standalone .boekje {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 1rem 3rem;
}

.boekje-standalone .boekje__page {
  display: block;
  width: min(100%, 297mm);
  aspect-ratio: 297 / 210;
  overflow: hidden;
  background: var(--bk-white);
  box-shadow: 0 12px 48px rgba(49, 27, 20, 0.14);
}

.boekje-standalone .bk-spread--full img,
.boekje-standalone .bk-spread--duo img,
.boekje-standalone .bk-spread--hero img,
.boekje-standalone .bk-spread--stack img,
.boekje-standalone .bk-intro__visual img,
.boekje-standalone .bk-chapter__visual img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  box-shadow: none;
}

.boekje-standalone .bk-spread {
  padding: 3mm;
  gap: 3mm;
}

.boekje-standalone .bk-intro__visual,
.boekje-standalone .bk-chapter__visual {
  padding: 0;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }

  .boekje-standalone {
    background: none;
  }

  .boekje-standalone .boekje-toolbar {
    display: none;
  }

  .boekje-standalone .boekje {
    gap: 0;
    padding: 0;
  }

  .boekje-standalone .boekje__page {
    width: 297mm;
    height: 210mm;
    aspect-ratio: auto;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }

  .boekje-standalone .boekje__page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}
