/**
 * Frontend Styles for Document Manager
 * NVK-style design: colors, fonts, and layout matching nvk.nl
 */

/* ===========================================
   NVK DESIGN TOKENS (matching theme)
   =========================================== */
.dm-frontend-wrapper {
    --dm-primary: #0080c9;
    --dm-secondary: #00a182;
    --dm-tertiary: #522582;
    --dm-accent: #c8057f;
    --dm-white: #fff;
    --dm-bg: #f2f2f2;
    --dm-text: #333;
    --dm-text-light: #666;
    --dm-border: #e0e0e0;
    --dm-radius: 19.2px;
    --dm-radius-s: 9.6px;
    --dm-shadow-s: 0 2px 8px rgba(0, 0, 0, 0.08);
    --dm-shadow-m: 0 4px 20px rgba(0, 0, 0, 0.1);
    --dm-font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --dm-font-heading: 'Rubik', 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --dm-header-offset: 123px; /* topbar (40px) + header (80px) + border (3px) */
}

/* ===========================================
   TABLES
   =========================================== */
.wp-block-table {
    width: 100%;
    margin: 1.5em 0;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
}

.wp-block-table table {
    width: 100%;
    border-collapse: collapse;
}

.wp-block-table td,
.wp-block-table th {
    padding: 12px 15px;
    border: 1px solid var(--dm-border, #e0e0e0);
    text-align: left;
    font-family: var(--dm-font-body, sans-serif);
}

.wp-block-table tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

.wp-block-table tr:hover {
    background-color: rgba(0, 128, 201, 0.04);
}

.wp-block-table th {
    background-color: var(--dm-primary, #0080c9);
    color: white;
    font-weight: 600;
    font-family: var(--dm-font-heading, sans-serif);
}

/* ===========================================
   IMAGES
   =========================================== */
.wp-block-image {
    margin: 1.5em 0;
    text-align: center;
}

.wp-block-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--dm-radius-s, 9.6px);
    box-shadow: var(--dm-shadow-s, 0 2px 8px rgba(0, 0, 0, 0.08));
}

.wp-block-image figcaption {
    margin-top: 0.5em;
    font-size: 0.9em;
    color: var(--dm-text-light, #666);
    font-style: italic;
    font-family: var(--dm-font-body, sans-serif);
}

/* ===========================================
   DOCUMENT CONTENT
   =========================================== */
.dm-document-content {
    font-family: var(--dm-font-body, sans-serif);
    font-size: 16px;
    line-height: 1.8;
    color: var(--dm-text, #333);
}

.dm-document-content h1,
.dm-document-content h2,
.dm-document-content h3,
.dm-document-content h4,
.dm-document-content h5 {
    margin: 1.5em 0 0.5em 0;
    font-weight: 700;
    font-family: var(--dm-font-heading, sans-serif);
    color: var(--dm-tertiary, #522582);
}

.dm-document-content h2 {
    font-size: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--dm-border, #e0e0e0);
    margin-top: 32px;
}

.dm-document-content h3 {
    font-size: 20px;
}

.dm-document-content p {
    margin: 1em 0;
}

.dm-document-content ul,
.dm-document-content ol {
    margin: 1em 0;
    padding-left: 32px;
}

.dm-document-content li {
    margin: 0.5em 0;
}

.dm-document-content blockquote {
    border-left: 4px solid var(--dm-primary, #0080c9);
    padding: 16px 24px;
    margin: 1.5em 0;
    background: rgba(0, 128, 201, 0.04);
    border-radius: 0 var(--dm-radius-s, 9.6px) var(--dm-radius-s, 9.6px) 0;
    color: var(--dm-text-light, #666);
    font-style: italic;
}

.dm-document-content a {
    color: var(--dm-primary, #0080c9);
    text-decoration: underline;
    text-decoration-color: rgba(0, 128, 201, 0.3);
    text-underline-offset: 2px;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.dm-document-content a:hover {
    color: var(--dm-tertiary, #522582);
    text-decoration-color: var(--dm-tertiary, #522582);
}

/* ===========================================
   RESPONSIVE TABLES
   =========================================== */
@media screen and (max-width: 768px) {
    .wp-block-table {
        font-size: 14px;
    }

    .wp-block-table td,
    .wp-block-table th {
        padding: 8px 10px;
    }
}

/* ===================================
   FRONTEND DOCUMENT VIEWER
   =================================== */

/* Main wrapper */
.dm-frontend-wrapper {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    /* Ruimte onder een vaste (position: fixed) siteheader; gezet door frontend.js */
    padding-top: var(--dm-content-offset, 0px);
    min-height: 100vh;
    background: var(--dm-bg, #f2f2f2);
    max-width: 1600px;
    margin: 0 auto;
}

/* ===========================================
   SIDEBAR
   =========================================== */
.dm-frontend-sidebar {
    width: 320px;
    background: linear-gradient(180deg, var(--dm-tertiary, #522582) 0%, #3d1b63 100%);
    color: #fff;
    position: sticky;
    top: var(--dm-header-offset, 123px);
    height: calc(100vh - var(--dm-header-offset, 123px));
    overflow-y: auto;
    flex-shrink: 0;
}

.dm-sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.dm-sidebar-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    font-family: var(--dm-font-heading, sans-serif);
    color: #fff;
    line-height: 1.4;
}

/* Search */
.dm-search-container {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.dm-search-input {
    width: 100%;
    padding: 10px 35px 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: var(--dm-radius, 19.2px);
    font-size: 14px;
    font-family: var(--dm-font-body, sans-serif);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dm-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.dm-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.dm-search-clear {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.dm-search-clear:hover {
    color: #fff;
}

.dm-search-clear .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* Search Results */
.dm-search-results {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dm-search-result-item {
    margin: 5px 0;
    border-radius: var(--dm-radius-s, 9.6px);
    border-left: 3px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.dm-search-result-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--dm-accent, #c8057f);
}

.dm-search-result-link {
    color: #fff;
    text-decoration: none;
    display: block;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--dm-radius-s, 9.6px);
}

.dm-search-result-title {
    font-weight: 600;
    font-size: 14px;
    font-family: var(--dm-font-heading, sans-serif);
    margin-bottom: 5px;
    display: block;
}

.dm-search-result-parent {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 5px;
    display: block;
}

.dm-search-result-excerpt {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

.dm-search-highlight {
    background: rgba(200, 5, 127, 0.4);
    padding: 2px 4px;
    border-radius: 3px;
    color: #fff;
}

.dm-search-results-header {
    padding: 8px 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--dm-font-body, sans-serif);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 8px;
}

.dm-search-result-number {
    color: var(--dm-accent, #c8057f);
    font-weight: 700;
    font-size: 13px;
    margin-right: 4px;
    font-family: var(--dm-font-heading, sans-serif);
}

.dm-search-result-current {
    background: rgba(200, 5, 127, 0.15) !important;
    border-left-color: var(--dm-accent, #c8057f) !important;
}

.dm-search-no-results {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-family: var(--dm-font-body, sans-serif);
}

/* Content highlight when scrolling to search term */
.dm-content-highlight {
    background: rgba(200, 5, 127, 0.25);
    padding: 2px 4px;
    border-radius: 3px;
    box-shadow: 0 0 0 3px rgba(200, 5, 127, 0.15);
    transition: background 0.6s ease, box-shadow 0.6s ease;
}

.dm-content-highlight-fade {
    background: transparent;
    box-shadow: 0 0 0 3px transparent;
}

/* ===========================================
   TABLE OF CONTENTS
   =========================================== */
.dm-toc-nav {
    padding: 16px 12px;
}

.dm-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dm-toc-chapter-item {
    margin: 4px 0;
}

/* Chapter row: link + toggle button side by side */
.dm-toc-chapter-row {
    display: flex;
    align-items: center;
}

.dm-toc-chapter-row > .dm-toc-link {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 10px 8px 10px 14px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: var(--dm-radius-s, 9.6px) 0 0 var(--dm-radius-s, 9.6px);
    font-weight: 600;
    font-size: 14px;
    font-family: var(--dm-font-heading, sans-serif);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-toc-chapter-row > .dm-toc-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--dm-accent, #c8057f);
    color: #fff;
}

.dm-toc-chapter-item.active > .dm-toc-chapter-row > .dm-toc-link,
.dm-toc-chapter-item.is-open > .dm-toc-chapter-row > .dm-toc-link {
    border-left-color: var(--dm-accent, #c8057f);
}

.dm-toc-chapter-item.active > .dm-toc-chapter-row > .dm-toc-link {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Toggle button */
.dm-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: none;
    border: none;
    border-radius: var(--dm-radius-s, 9.6px);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 4px;
}

.dm-toc-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.dm-toc-toggle-icon {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(-90deg);
}

.dm-toc-chapter-item.is-open .dm-toc-toggle-icon {
    transform: rotate(0deg);
}

/* Sublist: collapsed by default, open when is-open */
.dm-toc-sublist {
    list-style: none;
    margin: 0 0 0 12px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 0;
}

.dm-toc-chapter-item.is-open > .dm-toc-sublist {
    max-height: 2000px;
    opacity: 1;
    margin-top: 2px;
    margin-bottom: 2px;
}

.dm-toc-paragraph-item {
    margin: 2px 0;
}

.dm-toc-paragraph-item .dm-toc-link {
    display: block;
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-radius: var(--dm-radius-s, 9.6px);
    font-size: 13px;
    font-family: var(--dm-font-body, sans-serif);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
}

.dm-toc-paragraph-item .dm-toc-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border-left-color: var(--dm-accent, #c8057f);
}

.dm-toc-paragraph-item.active .dm-toc-link {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-left-color: var(--dm-accent, #c8057f);
}

/* ===========================================
   MAIN CONTENT AREA
   =========================================== */
.dm-frontend-main {
    flex: 1;
    background: var(--dm-white, #fff);
    min-width: 0;
}

.dm-document-article {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 40px;
}

/* ===========================================
   DOCUMENT HEADER
   =========================================== */
.dm-document-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--dm-border, #e0e0e0);
}

.dm-document-title {
    font-size: 35.2px;
    font-weight: 700;
    font-family: var(--dm-font-heading, sans-serif);
    color: var(--dm-tertiary, #522582);
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.dm-breadcrumb {
    font-size: 14px;
    font-family: var(--dm-font-body, sans-serif);
    color: var(--dm-text-light, #666);
}

.dm-breadcrumb a {
    color: var(--dm-primary, #0080c9);
    text-decoration: none;
    transition: color 0.2s;
}

.dm-breadcrumb a:hover {
    color: var(--dm-tertiary, #522582);
    text-decoration: underline;
}

.dm-breadcrumb-sep {
    margin: 0 8px;
    color: #bbb;
}

.dm-breadcrumb-current {
    color: var(--dm-text, #333);
    font-weight: 500;
}

/* ===========================================
   CHILD SECTIONS
   =========================================== */
.dm-child-sections {
    margin: 48px 0;
    padding: 32px;
    background: var(--dm-bg, #f2f2f2);
    border-radius: var(--dm-radius, 19.2px);
    border-left: 4px solid var(--dm-primary, #0080c9);
}

.dm-child-sections-title {
    font-size: 22.4px;
    font-weight: 700;
    font-family: var(--dm-font-heading, sans-serif);
    color: var(--dm-tertiary, #522582);
    margin: 0 0 20px 0;
}

.dm-child-sections-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.dm-child-section-item {
    margin: 0;
}

.dm-child-section-link {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--dm-white, #fff);
    border: 1px solid var(--dm-border, #e0e0e0);
    border-radius: var(--dm-radius-s, 9.6px);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 12px;
    box-shadow: var(--dm-shadow-s, 0 2px 8px rgba(0, 0, 0, 0.08));
}

.dm-child-section-link:hover {
    border-color: var(--dm-primary, #0080c9);
    box-shadow: var(--dm-shadow-m, 0 4px 20px rgba(0, 0, 0, 0.1));
    transform: translateY(-2px);
}

.dm-child-section-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--dm-tertiary, #522582), var(--dm-primary, #0080c9));
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    font-family: var(--dm-font-heading, sans-serif);
    flex-shrink: 0;
}

.dm-child-section-title {
    color: var(--dm-tertiary, #522582);
    font-weight: 600;
    font-size: 15px;
    font-family: var(--dm-font-heading, sans-serif);
}

.dm-child-section-link:hover .dm-child-section-title {
    color: var(--dm-primary, #0080c9);
}

/* ===========================================
   PREV / NEXT NAVIGATION
   =========================================== */
.dm-document-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 56px;
    padding-top: 32px;
    border-top: 2px solid var(--dm-border, #e0e0e0);
}

.dm-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--dm-bg, #f2f2f2);
    border: 1px solid var(--dm-border, #e0e0e0);
    border-radius: var(--dm-radius, 19.2px);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    max-width: 350px;
}

.dm-nav-link:hover {
    background: var(--dm-primary, #0080c9);
    border-color: var(--dm-primary, #0080c9);
    color: #fff;
    box-shadow: var(--dm-shadow-m, 0 4px 20px rgba(0, 0, 0, 0.1));
    transform: translateX(0);
}

.dm-nav-prev:hover {
    transform: translateX(-4px);
}

.dm-nav-next:hover {
    transform: translateX(4px);
}

.dm-nav-next {
    margin-left: auto;
    justify-content: flex-end;
}

.dm-nav-arrow {
    font-size: 20px;
    color: var(--dm-primary, #0080c9);
    transition: color 0.2s;
}

.dm-nav-link:hover .dm-nav-arrow {
    color: #fff;
}

.dm-nav-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dm-nav-label-small {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    font-family: var(--dm-font-body, sans-serif);
    color: var(--dm-text-light, #666);
}

.dm-nav-link:hover .dm-nav-label-small {
    color: rgba(255, 255, 255, 0.8);
}

.dm-nav-label-title {
    font-weight: 600;
    font-size: 15px;
    font-family: var(--dm-font-heading, sans-serif);
    color: var(--dm-tertiary, #522582);
}

.dm-nav-link:hover .dm-nav-label-title {
    color: #fff;
}

/* ===========================================
   SCROLLBAR (sidebar)
   =========================================== */
.dm-frontend-sidebar::-webkit-scrollbar {
    width: 6px;
}

.dm-frontend-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.dm-frontend-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.dm-frontend-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media screen and (max-width: 1024px) {
    .dm-frontend-sidebar {
        width: 280px;
    }

    .dm-document-article {
        padding: 32px 24px;
    }

    .dm-document-title {
        font-size: 28.8px;
    }
}

@media screen and (max-width: 768px) {
    .dm-frontend-wrapper {
        flex-direction: column;
    }

    .dm-frontend-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
    }

    .dm-document-article {
        padding: 24px 16px;
    }

    .dm-document-title {
        font-size: 25.6px;
    }

    .dm-child-sections {
        padding: 20px;
    }

    .dm-child-sections-list {
        grid-template-columns: 1fr;
    }

    .dm-document-nav {
        flex-direction: column;
    }

    .dm-nav-link {
        max-width: none;
    }
}

/* ===========================================
   WP ADMIN BAR OFFSET
   =========================================== */
body.admin-bar .dm-frontend-sidebar {
    top: calc(var(--dm-header-offset, 123px) + 32px);
    height: calc(100vh - var(--dm-header-offset, 123px) - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .dm-frontend-sidebar {
        top: calc(var(--dm-header-offset, 123px) + 46px);
        height: calc(100vh - var(--dm-header-offset, 123px) - 46px);
    }
}

/* ===========================================
   THEMA'S (TEGELS) EN HOOFDSTUK-IMPORT (1.3.0)
   =========================================== */
.dm-sidebar-header h2 a {
    color: inherit;
    text-decoration: none;
}

.dm-sidebar-header h2 a:hover,
.dm-sidebar-header h2 a:focus-visible {
    text-decoration: underline;
}

/* Thema in de inhoudsopgave */
.dm-toc-theme-item {
    margin: 12px 0 4px;
}

.dm-toc-theme-link {
    display: block;
    padding: 6px 14px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--dm-font-heading, sans-serif);
}

.dm-toc-theme-link:hover,
.dm-toc-theme-link:focus-visible,
.dm-toc-theme-link[aria-current="page"] {
    color: #fff;
    text-decoration: underline;
}

.dm-toc-theme-chapters {
    margin-left: 4px;
}

.dm-toc-link:focus-visible,
.dm-toc-toggle:focus-visible,
.dm-theme-tile a:focus-visible,
.dm-child-section-link:focus-visible,
.dm-nav-link:focus-visible {
    outline: 2px solid var(--dm-accent, #c8057f);
    outline-offset: 2px;
}

/* Tegels op de boekpagina */
.dm-theme-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.dm-theme-tile {
    display: flex;
    flex-direction: column;
    background: var(--dm-white, #fff);
    border: 1px solid var(--dm-border, #e0e0e0);
    border-top: 4px solid var(--dm-primary, #0080c9);
    border-radius: var(--dm-radius-s, 9.6px);
    box-shadow: var(--dm-shadow-s, 0 2px 8px rgba(0, 0, 0, 0.08));
    padding: 20px 22px;
    font-family: var(--dm-font-body, sans-serif);
}

.dm-theme-tile:nth-child(4n+2) { border-top-color: var(--dm-secondary, #00a182); }
.dm-theme-tile:nth-child(4n+3) { border-top-color: var(--dm-tertiary, #522582); }
.dm-theme-tile:nth-child(4n+4) { border-top-color: var(--dm-accent, #c8057f); }

.dm-theme-tile-image {
    display: block;
    margin: -20px -22px 16px;
}

.dm-theme-tile-image img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.dm-theme-tile-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-family: var(--dm-font-heading, sans-serif);
    line-height: 1.3;
}

.dm-theme-tile-title a {
    color: var(--dm-tertiary, #522582);
    text-decoration: none;
}

.dm-theme-tile-title a:hover {
    color: var(--dm-primary, #0080c9);
    text-decoration: underline;
}

.dm-theme-tile-excerpt {
    margin: 0 0 12px;
    color: var(--dm-text-light, #666);
    font-size: 14px;
}

.dm-theme-tile-chapters {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    font-size: 14px;
}

.dm-theme-tile-chapters li {
    padding: 6px 0;
    border-top: 1px solid var(--dm-border, #e0e0e0);
}

.dm-theme-tile-chapters a {
    color: #00639c; /* donkerder dan --dm-primary voor WCAG AA-contrast */
    text-decoration: none;
}

.dm-theme-tile-chapters a:hover {
    text-decoration: underline;
}

/* Kopnummer en conceptmelding */
.dm-document-number {
    color: var(--dm-primary, #0080c9);
    margin-right: 0.25em;
}

.dm-status-notice {
    display: inline-block;
    margin: 8px 0 0;
    padding: 4px 10px;
    background: #fcf0d4;
    color: #6b4c00;
    border-radius: var(--dm-radius-s, 9.6px);
    font-size: 13px;
    font-family: var(--dm-font-body, sans-serif);
}

/* Geïmporteerde hoofdstukinhoud */
.dm-document-content h2,
.dm-document-content h3,
.dm-document-content h4 {
    scroll-margin-top: calc(var(--dm-header-offset, 123px) + 16px);
}

.dm-document-content h4 {
    font-size: 16.8px;
}

.dm-tabel-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 1em 0 1.5em;
}

.dm-tabel {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.5;
}

.dm-tabel td,
.dm-tabel th {
    padding: 8px 12px;
    border: 1px solid var(--dm-border, #e0e0e0);
    text-align: left;
    vertical-align: top;
}

.dm-tabel th {
    background: var(--dm-tertiary, #522582);
    color: #fff;
}

.dm-tabel tr:nth-child(even) td {
    background-color: rgba(0, 0, 0, 0.02);
}

.dm-tabel p {
    margin: 0 0 0.4em;
}

.dm-tabel p:last-child,
.dm-tabel ul:last-child,
.dm-tabel ol:last-child {
    margin-bottom: 0;
}

.dm-tabel ul,
.dm-tabel ol {
    margin: 0.3em 0;
    padding-left: 20px;
}

.dm-tabel li {
    margin: 0.2em 0;
}

.dm-bijschrift {
    margin-bottom: 0.4em;
    font-weight: 600;
    color: var(--dm-tertiary, #522582);
}

.dm-figuur {
    margin: 1.5em 0;
}

.dm-figuur img {
    max-width: 100%;
    height: auto;
}

.dm-auteurs {
    color: var(--dm-text-light, #666);
    font-style: italic;
}

@media screen and (max-width: 768px) {
    .dm-theme-tiles {
        grid-template-columns: 1fr;
    }

    .dm-tabel {
        font-size: 14px;
    }
}

/* Tabeltekst: thema's met een eigen td-lettergrootte niet laten winnen (1.4.2) */
.dm-tabel td,
.dm-tabel th {
    font-size: inherit;
}

/* Mobiel: inklapbare inhoudsopgave (1.4.2) */
.dm-toc-mobile-toggle {
    display: none;
}

@media screen and (max-width: 768px) {
    .dm-toc-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        margin-top: 12px;
        padding: 10px 14px;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.35);
        border-radius: 9.6px;
        color: #fff;
        font-size: 15px;
        font-weight: 600;
        font-family: var(--dm-font-heading, sans-serif);
        cursor: pointer;
    }

    .dm-toc-mobile-toggle::after {
        content: "";
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform 0.2s;
    }

    .dm-frontend-sidebar.toc-open .dm-toc-mobile-toggle::after {
        transform: rotate(-135deg);
    }

    .dm-toc-mobile-toggle:focus-visible {
        outline: 2px solid var(--dm-accent, #c8057f);
        outline-offset: 2px;
    }

    .dm-js .dm-frontend-sidebar:not(.toc-open) .dm-toc-nav {
        display: none;
    }
}
