/* ============================================
   CUSTOM HTML MODULE WRAPPER
   ============================================ */

[data-module-type="custom_html"] {
    width: 100%;
}

[data-module-type="custom_html"] .module-title {
    font-size: var(--fs-title);
    font-weight: 600;
    color: var(--text-ink);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

/* ============================================
   CUSTOM HTML MODULE CONTENT
   ============================================ */

[data-module-type="custom_html"] img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

[data-module-type="custom_html"] a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

[data-module-type="custom_html"] a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

[data-module-type="custom_html"] table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

[data-module-type="custom_html"] table th,
[data-module-type="custom_html"] table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    text-align: start;
}

[data-module-type="custom_html"] table th {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-strong);
    font-weight: 600;
    color: var(--text-ink);
}

[data-module-type="custom_html"] table tbody tr:hover td {
    background-color: var(--surface-sunken);
}

[data-module-type="custom_html"] blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1.25rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-style: italic;
    color: var(--text-muted);
}

/* ============================================
   CUSTOM TAG STYLES
   ============================================ */

[data-module-type="custom_html"] .custom-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    overflow: hidden;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

[data-module-type="custom_html"] .custom-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

[data-module-type="custom_html"] .custom-link-btn {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--bg-color);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

[data-module-type="custom_html"] .custom-link-btn:hover,
[data-module-type="custom_html"] .custom-link-btn:focus-visible {
    background-color: var(--secondary-color);
    box-shadow: var(--shadow-sm);
    color: var(--bg-color);
    text-decoration: none;
}

[data-module-type="custom_html"] .custom-link-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   MODULE WRAPPER (Position context)
   ============================================ */

.module-wrapper [data-module-type="custom_html"] {
    margin-bottom: 0;
}

/* Show title styling for custom_html modules */
.module-wrapper.show-title [data-module-type="custom_html"] .module-title {
    display: block;
}

.module-wrapper:not(.show-title) [data-module-type="custom_html"] .module-title {
    display: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    [data-module-type="custom_html"] table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   MOTION — respect reduced-motion preference
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    [data-module-type="custom_html"] a,
    [data-module-type="custom_html"] .custom-link-btn {
        transition: none;
    }

    [data-module-type="custom_html"] .custom-link-btn:hover,
    [data-module-type="custom_html"] .custom-link-btn:focus-visible {
        box-shadow: none;
    }
}
