.vdb-act-margins { display: none; }

@media screen and (min-width: 761px) and (any-pointer: fine) {
  html:has(body > .vdb-act-margins) {
    --vdb-act-gutter: clamp(48px, calc((100vw - 790px) / 2), min(11vw, 190px));
    --vdb-blank-paper: linear-gradient(rgba(255, 246, 222, .56), rgba(255, 246, 222, .56)), url('/assets/ottersum-register-zijranden/blanco-papier.webp');
    background-color: #e7ccaa;
  }

  body:has(> .vdb-act-margins) {
    margin-inline: var(--vdb-act-gutter) !important;
    background-color: #ead4b0;
    background-image: var(--vdb-blank-paper) !important;
    background-size: auto, 660px auto;
  }

  body[data-view="legacy-home"]:has(> .vdb-act-margins) {
    width: auto;
  }

  body:has(> .vdb-act-margins) :is(.hero, .site-return, .original-act-background, .content-section, .dossier-intro, .subhero, .dashboard, .sources) {
    background-image: none !important;
  }

  body:has(> .vdb-act-margins) .topbar {
    padding-inline: clamp(12px, 2vw, 28px);
  }

  body:has(> .vdb-act-margins) .topbar nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    column-gap: clamp(8px, 1vw, 16px);
    row-gap: 4px;
    min-width: 0;
  }

  body[data-view="legacy-home"]:has(> .vdb-act-margins) .hero,
  body:has(> .vdb-act-margins) > :is(header.topbar, header.site, nav.site-return) {
    background-color: #ead4b0;
    background-image: var(--vdb-blank-paper) !important;
    background-size: auto, 660px auto;
    background-position: left top;
    background-repeat: repeat;
  }

  body:has(> .vdb-act-margins) > :is(header.topbar, header.site, nav.site-return) {
    box-sizing: border-box;
    width: var(--vdb-reading-width, 100%);
    max-width: 100%;
    margin-inline: auto;
  }

  body:has(> .vdb-act-margins) > header.topbar {
    min-height: 64px;
    height: auto;
    padding-block: 8px;
  }

  body:has(> .vdb-act-margins) > nav.site-return {
    padding: 8px clamp(12px, 2vw, 28px);
  }

  body:has(> .vdb-act-margins) > :is(header.site, nav.site-return, footer) {
    position: relative;
    z-index: 2;
  }

  body[data-view="legacy-home"]:has(> .vdb-act-margins) .hero-copy {
    position: relative;
    z-index: 2;
  }

  .vdb-act-margins {
    display: contents;
    pointer-events: none;
  }

  .vdb-act-margins > div {
    position: fixed;
    inset-block: 0;
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 2px;
    background: #e7ccaa;
    z-index: 1;
  }

  .vdb-act-margins > div:first-child {
    inset-inline-start: 0;
    width: var(--vdb-act-left, var(--vdb-act-gutter));
  }

  .vdb-act-margins > div:last-child {
    inset-inline-end: 0;
    width: var(--vdb-act-right, var(--vdb-act-gutter));
  }

  .vdb-act-margins span {
    display: block;
    background: var(--vdb-act-image) center 30% / cover no-repeat;
  }
}

@media screen {
  body:has(> .vdb-site-header) {
    --vdb-paper-color: #efdfc3;
    --vdb-paper-texture: linear-gradient(#fff8e6ab, #fff8e6ab), url('/assets/ottersum-register-zijranden/blanco-papier.webp');
    --vdb-frame-color: #a87d4c;
    --vdb-frame-width: 9px;
    --vdb-frame-radius: 22px;
    --vdb-header-min-height: 65px;
  }

  body > .vdb-site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: var(--vdb-reading-width, 100%);
    max-width: 100%;
    min-height: var(--vdb-header-min-height);
    margin-inline: auto;
    padding: 6px clamp(12px, 2vw, 28px);
    border-block-end: 1px solid #bd91496b;
    box-shadow: inset 0 3px #1267b2;
    color: #152738;
    background-color: var(--vdb-paper-color);
    background-image: var(--vdb-paper-texture);
    background-size: auto, 660px auto;
  }

  .vdb-site-header .vdb-site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    font: 400 clamp(1rem, 2vw, 1.17rem)/1.12 Georgia, serif;
  }

  .vdb-site-brand img {
    display: block;
    flex: 0 0 46px;
    width: 46px;
    height: 52px;
    object-fit: contain;
    mix-blend-mode: multiply;
  }

  .vdb-site-brand small {
    display: block;
    margin-top: 4px;
    font: 500 .65rem/1.1 system-ui, sans-serif;
    letter-spacing: .14em;
    text-transform: uppercase;
  }

  .vdb-site-header #vdb-site-navigation {
    display: flex;
    justify-content: end;
    flex-wrap: wrap;
    gap: 4px clamp(8px, 1.1vw, 16px);
    font: 400 .86rem/1.4 system-ui, sans-serif;
  }

  .vdb-site-header #vdb-site-navigation a {
    color: #233f52;
    text-decoration: none;
    white-space: nowrap;
  }

  .vdb-site-header #vdb-site-navigation a:hover {
    color: #15518a;
    text-decoration: underline;
  }

  .vdb-site-header .vdb-site-menu {
    display: none;
    padding: 8px 11px;
    border: 1px solid #15518a;
    border-radius: 6px;
    color: white;
    background: #15518a;
    font: 600 .9rem/1.2 system-ui, sans-serif;
  }

  body:has(> .vdb-site-header) > header.topbar,
  body:has(> .vdb-site-header) > .vdb-context-navigation[hidden] {
    display: none !important;
  }

  body:has(> .vdb-site-header) > .vdb-context-navigation:not([hidden]) {
    position: relative;
    inset: auto;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    height: auto;
    min-height: 0;
    width: var(--vdb-reading-width, 100%);
    max-width: 100%;
    margin-inline: auto;
    padding: 8px clamp(12px, 2vw, 28px);
    box-sizing: border-box;
    box-shadow: none;
    color: #233f52;
    background: var(--vdb-paper-color);
    background-image: var(--vdb-paper-texture) !important;
    background-size: auto, 660px auto;
  }

  .vdb-context-navigation a {
    color: #15518a;
  }

  /* An inset frame keeps the original story and scan widths on small screens. */
  body:has(> .vdb-site-header) :is(
    article.home-story,
    article.kaart,
    body[data-view="legacy-home"] main > .hero,
    body:not([data-view="legacy-home"]) main:not(#book-main, .maaseik-main),
    body:not(:has(main)) > article,
    main.maaseik-main > article,
    #book-spread
  ),
  body:has(> .vdb-site-header) .vdb-paper-panel {
    background-color: var(--vdb-paper-color) !important;
    background-image: var(--vdb-paper-texture) !important;
    background-size: auto, 660px auto !important;
    background-position: left top !important;
    background-repeat: repeat !important;
  }

  body:has(> .vdb-site-header) :is(
    article.home-story,
    article.kaart,
    body[data-view="legacy-home"] main > .hero,
    body:not([data-view="legacy-home"]) main:not(#book-main, .maaseik-main),
    body:not(:has(main)) > article,
    main.maaseik-main > article,
    #book-spread
  ) {
    outline: var(--vdb-frame-width) solid var(--vdb-frame-color);
    outline-offset: calc(-1 * var(--vdb-frame-width));
    border-radius: var(--vdb-frame-radius);
  }

  body:has(> .vdb-site-header) main > article.verhaal {
    padding: clamp(18px, 3vw, 40px);
  }

  body.book-flow:has(> .vdb-site-header) {
    width: auto;
    --vdb-book-main-height: calc(100dvh - var(--vdb-header-height, var(--vdb-header-min-height)));
  }

  body.book-flow:not(.book-continuous):has(> .vdb-site-header) #book-main {
    height: var(--vdb-book-main-height);
  }

  body.book-flow:not(.book-continuous):has(> .vdb-site-header) #book-spread {
    height: var(--vdb-book-main-height) !important;
    border-radius: var(--vdb-frame-radius);
  }

  body.ha-overlay-open > .vdb-site-header {
    visibility: hidden;
  }

  body:has(> .vdb-site-header) #book-website-back {
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    right: auto;
    left: max(8px, env(safe-area-inset-left));
  }
}

@media screen and (max-width: 900px) {
  .vdb-site-header .vdb-site-menu { display: inline-flex; }
  .vdb-site-header #vdb-site-navigation {
    display: none;
    position: absolute;
    inset: 100% 0 auto;
    padding: 12px;
    justify-content: start;
    border-bottom: 1px solid #bd9149;
    background: var(--vdb-paper-color);
    background-image: var(--vdb-paper-texture);
    background-size: auto, 660px auto;
  }
  .vdb-site-header .vdb-site-menu[aria-expanded="true"] + #vdb-site-navigation { display: flex; }
  .vdb-site-header #vdb-site-navigation a { padding: 6px; }
}

@media print {
  .vdb-site-header { display: none !important; }
}

@media screen {
  .vdb-context-navigation > nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
  }
  .vdb-context-navigation > :is(.brand, .site-brand, .mast-brand) {
    display: none;
  }
  body:has(> .vdb-site-header) #book-spread .book-flow-page {
    background-image: var(--vdb-paper-texture);
  }
  body:has(> .vdb-site-header) :is(.home-family-arms > a, article .vdb-paper-panel) {
    border-color: #b89364;
  }
}

@media screen {
  body[data-view="legacy-home"]:has(> .vdb-site-header) {
    --vdb-home-width: min(100%, 1088px);
  }

  /* Keep the entire homepage in the same column as the side scans. */
  body[data-view="legacy-home"]:has(> .vdb-site-header) > :is(main, footer) {
    position: relative;
    z-index: 2;
    width: var(--vdb-home-width);
    min-width: 0;
    margin-inline: auto;
    box-sizing: border-box;
    overflow-wrap: anywhere;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) main > .hero {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    box-sizing: border-box;
    padding-inline: clamp(12px, 2vw, 24px);
  }

  .home-family-arms img {
    mix-blend-mode: multiply;
  }

  .vdb-article-paintings {
    width: min(100% - 36px, 780px);
    margin: 32px auto;
    padding-bottom: 20px;
  }
}

@media screen {
  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht > :is(section:not(.hero), aside, details, p),
  body[data-view="legacy-home"]:has(> .vdb-site-header) > footer {
    padding-inline: clamp(16px, 3vw, 36px);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht > :is(section:not(.hero), aside, details) {
    width: 100%;
    margin: 20px auto;
    padding-block: clamp(24px, 4vw, 48px);
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht > p {
    margin: 0;
    padding-block: .55rem;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) > footer {
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht > :is(section:not(.hero), aside, details),
  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht :is(
    .chapter-card, .source-grid > *, .person-card, .map-card, #genealogy-search
  ) {
    background-color: var(--vdb-paper-color) !important;
    background-image: var(--vdb-paper-texture) !important;
    background-size: auto, 660px auto !important;
    background-position: left top !important;
    background-repeat: repeat !important;
    outline: var(--vdb-frame-width) solid var(--vdb-frame-color);
    outline-offset: calc(-1 * var(--vdb-frame-width));
    border-radius: var(--vdb-frame-radius);
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht :is(
    .chapter-card, .source-grid > *, .person-card, .map-card
  ) {
    padding: clamp(18px, 2.4vw, 28px);
    min-width: 0;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht :is(.chapter-grid, .source-grid) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht :is(.section-head > *, .places-grid > *) {
    min-width: 0;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht :is(.archive-actions, .filters) {
    flex-wrap: wrap;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht .next-step,
  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht .next-step :is(p, .query span, .query small) {
    color: #233f52;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #genealogy-search :is(input, .genealogy-search-result, .genealogy-search-empty) {
    background: var(--vdb-paper-texture), #faf0dc;
    background-size: auto, 420px auto;
    border-radius: 6px;
  }

  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht #genealogy-search {
    border-color: var(--vdb-frame-color);
  }
}

@media screen and (min-width: 981px) {
  body[data-view="legacy-home"]:has(> .vdb-site-header) #overzicht .places-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
    gap: clamp(18px, 3vw, 38px);
  }
}

.vdb-painting {
  max-width: 760px;
  margin: 1.25rem auto;
}

.vdb-painting img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

.vdb-painting figcaption {
  margin-top: .6rem;
  color: #59442e;
  font: .9rem/1.45 system-ui, sans-serif;
}

#book-spread .vdb-painting img {
  max-height: 36vh;
  object-fit: contain;
}
