/**
 * OM Starter — Globale aanvullingen
 *
 * Aanvullende styling die niet via theme.json kan:
 * header transitions, scroll-to-top, animatie keyframes.
 *
 * @package OM_Starter
 * @since 1.0.0
 */

/* ──────────────────────────────────────────────
   Shadow utility classes (mapping theme.json presets)
   ────────────────────────────────────────────── */

.has-shadow-sm { box-shadow: var(--wp--preset--shadow--sm); }
.has-shadow-md { box-shadow: var(--wp--preset--shadow--md); }
.has-shadow-lg { box-shadow: var(--wp--preset--shadow--lg); }
.has-shadow-xl { box-shadow: var(--wp--preset--shadow--xl); }

/* ──────────────────────────────────────────────
   Header — Sticky, shrink, transparant
   ────────────────────────────────────────────── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--wp--preset--color--white);
    transition:
        padding var(--wp--custom--transition--base),
        background-color var(--wp--custom--transition--base),
        box-shadow var(--wp--custom--transition--base);
}

.site-header.is-sticky {
    box-shadow: var(--wp--preset--shadow--sm);
}

.site-header.is-shrunk {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

/* Transparant variant — voeg .has-transparent-header toe aan body */
body.has-transparent-header .site-header:not(.is-sticky) {
    background-color: transparent;
    position: fixed;
    width: 100%;
}

body.has-transparent-header .site-header:not(.is-sticky),
body.has-transparent-header .site-header:not(.is-sticky) a {
    color: var(--wp--preset--color--white);
}

body.has-transparent-header .site-header.is-sticky {
    background-color: var(--wp--preset--color--white);
    color: var(--wp--preset--color--dark);
}

/* ──────────────────────────────────────────────
   Scroll-to-top button
   ────────────────────────────────────────────── */

.om-scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--white);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(1rem);
    transition:
        opacity var(--wp--custom--transition--base),
        visibility var(--wp--custom--transition--base),
        transform var(--wp--custom--transition--base),
        background-color var(--wp--custom--transition--base);
    box-shadow: var(--wp--preset--shadow--md);
}

.om-scroll-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.om-scroll-to-top:hover {
    background-color: var(--wp--preset--color--dark);
}

.om-scroll-to-top:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 2px;
}

/* ──────────────────────────────────────────────
   Scroll animaties — Keyframes
   ────────────────────────────────────────────── */

.om-fade-up,
.om-fade-in,
.om-fade-left,
.om-fade-right {
    opacity: 0;
    transition:
        opacity var(--wp--custom--transition--slow),
        transform var(--wp--custom--transition--slow);
}

.om-fade-up {
    transform: translateY(2rem);
}

.om-fade-left {
    transform: translateX(-2rem);
}

.om-fade-right {
    transform: translateX(2rem);
}

.om-fade-up.om-visible,
.om-fade-in.om-visible,
.om-fade-left.om-visible,
.om-fade-right.om-visible {
    opacity: 1;
    transform: translate(0);
}

/* fadeInUp keyframe voor custom token referentie */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ──────────────────────────────────────────────
   Reduced motion
   ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .om-fade-up,
    .om-fade-in,
    .om-fade-left,
    .om-fade-right {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .site-header {
        transition: none;
    }

    .om-scroll-to-top {
        transition: none;
    }

    .om-form__field input,
    .om-form__field textarea,
    .om-form__button {
        transition: none;
    }
}

/* ──────────────────────────────────────────────
   Formulieren
   ────────────────────────────────────────────── */

.om-form__fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.om-form__field--full {
    grid-column: 1 / -1;
}

.om-form__field--half {
    grid-column: span 1;
}

@media (max-width: 600px) {
    .om-form__fields {
        grid-template-columns: 1fr;
    }

    .om-form__field--half {
        grid-column: span 1;
    }
}

.om-form__field label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--wp--preset--color--dark);
}

.om-form__required {
    color: var(--wp--preset--color--primary);
}

.om-form__field input,
.om-form__field textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d0d0d0;
    border-radius: var(--wp--custom--border-radius--sm);
    background-color: var(--wp--preset--color--white);
    color: var(--wp--preset--color--dark);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color var(--wp--custom--transition--base),
                box-shadow var(--wp--custom--transition--base);
}

.om-form__field input:focus,
.om-form__field textarea:focus {
    outline: none;
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wp--preset--color--primary) 15%, transparent);
}

.om-form__field textarea {
    resize: vertical;
    min-height: 120px;
}

/* Error state */
.om-form__field.has-error input,
.om-form__field.has-error textarea {
    border-color: #dc3545;
}

.om-form__field.has-error input:focus,
.om-form__field.has-error textarea:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.om-form__error {
    display: block;
    min-height: 1.25rem;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: #dc3545;
    line-height: 1.25rem;
}

/* Honeypot — verborgen voor mensen */
.om-form__field--hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

/* Turnstile widget */
.om-form__turnstile {
    margin-top: 1rem;
}

/* Submit */
.om-form__submit {
    margin-top: 1.5rem;
}

.om-form__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 160px;
    padding: 0.875rem 2rem;
    cursor: pointer;
    transition: background-color var(--wp--custom--transition--base),
                opacity var(--wp--custom--transition--base);
}

.om-form__button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.om-form__button-loading svg {
    display: block;
}

/* Feedback berichten */
.om-form__message {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--wp--custom--border-radius--sm);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.om-form__message--success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.om-form__message--error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Select dropdown */
.om-form__field select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d0d0d0;
    border-radius: var(--wp--custom--border-radius--sm);
    background-color: var(--wp--preset--color--white);
    color: var(--wp--preset--color--dark);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23686868' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
    transition: border-color var(--wp--custom--transition--base),
                box-shadow var(--wp--custom--transition--base);
}

.om-form__field select:focus {
    outline: none;
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wp--preset--color--primary) 15%, transparent);
}

/* Fieldset (radio, checkbox_group) */
.om-form__field fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

.om-form__field fieldset legend {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--wp--preset--color--dark);
}

.om-form__options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.om-form__option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--wp--preset--color--dark);
    cursor: pointer;
}

.om-form__option input[type="radio"],
.om-form__option input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--wp--preset--color--primary);
    cursor: pointer;
}

.om-form__option--single {
    margin-top: 0.25rem;
}

/* Section headings within forms */
.om-form__section-heading {
    padding-top: 0.5rem;
}

.om-form__section-title {
    margin: 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--wp--preset--color--primary);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--wp--preset--color--dark);
}

/* Error states for new field types */
.om-form__field.has-error select {
    border-color: #dc3545;
}

.om-form__field.has-error select:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* ──────────────────────────────────────────────
   Footer links — inherit kleur binnen donkere achtergrond
   ────────────────────────────────────────────── */

.site-footer a {
    color: inherit;
}

.site-footer a:hover {
    opacity: 0.8;
}
