/* BUZÓN PROTECCION */

:root {
    
    --dark: #093743;
    --accent: #c79a3b;
    --text: #26343c;
    --muted: #6d7a82;
    --border: #d4e0e4;
    --soft: #f4f7f8;
    --shadow: 0 22px 50px rgba(9, 55, 67, .16);
}

.buzon-section {
    position: relative;
    padding-top: 48px;
    padding-bottom: 65px;
    isolation: isolate;
}

/* Fondo institucional detrás de las tarjetas */
.buzon-section::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 150px;
    left: 50%;
    width: 100vw;
    height: 420px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, rgb(32, 32, 128) , rgb(3, 3, 109));
}

.buzon-intro {
    margin-bottom: 24px;
    padding-left: 2px;
}

.buzon-intro h2 {
    color: var(--text);
    font: 700 clamp(30px, 3vw, 40px)/1.1 "Playfair Display", Georgia, serif;
    margin: 5px 0 6px;
}

.buzon-intro p {
    color: var(--muted);
    margin: 0;
    font-size: 14px;
}

.buzon-layout {
    position: relative;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: center;
    gap: 0;
}

/* Panel izquierdo */
.buzon-info {
    position: relative;
    z-index: 2;
    margin: 0 -42px 0 0;
    padding: 30px 28px;
    min-height: 390px;
    border-radius: 4px;
    background: linear-gradient(160deg, rgb(0,71,186), #27168a);
    color: #fff;
    box-shadow: 0 18px 38px rgba(4, 34, 42, .25);
}

.buzon-info-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 20px;
}

.buzon-info-label {
    display: block;
    color: #e4c77f;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
    margin-bottom: 7px;
}

.buzon-info h3 {
    color: #fff;
    font-size: 26px;
    line-height: 1.15;
    margin: 0 0 12px;
}

.buzon-info > p {
    color: rgba(255, 255, 255, .86);
    font-size: 13px;
    line-height: 1.65;
    margin: 0;
}

.buzon-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 24px;
    padding: 13px;
    border-left: 3px solid var(--accent);
    border-radius: 0 9px 9px 0;
    background: rgba(255, 255, 255, .10);
}

.buzon-notice-icon {
    flex: 0 0 auto;
    color: #e4c77f;
    padding-top: 1px;
}

.buzon-notice strong,
.buzon-notice span {
    display: block;
}

.buzon-notice strong {
    color: #fff;
    font-size: 12px;
    margin-bottom: 3px;
}

.buzon-notice span {
    color: rgba(255, 255, 255, .76);
    font-size: 11px;
    line-height: 1.5;
}

/* Formulario */
.buzon-form {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
    padding: 29px 34px 23px 76px;
    border: 1px solid rgba(201, 215, 220, .9);
    border-radius: 4px;
    background: #fff;
    box-shadow: var(--shadow);
}

.buzon-form-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 14px;
    margin-bottom: 17px;
    border-bottom: 1px solid var(--border);
}

.buzon-form-head > div:first-child > span {
    display: block;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .13em;
    margin-bottom: 3px;
}

.buzon-form-head h3 {
    color: var(--text);
    font-size: 21px;
    margin: 0;
}

.buzon-required {
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.buzon-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px 18px;
}

.buzon-field {
    display: block;
    min-width: 0;
}

.buzon-field-full,
.buzon-field-message {
    grid-column: 1 / -1;
}

.buzon-field > span {
    display: block;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
}

.buzon-field > span b {
    color: var(--accent);
}

.buzon-field input,
.buzon-field select,
.buzon-field textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 0;
    border-bottom: 1.5px solid #aebbc0;
    border-radius: 0;
    outline: 0;
    background: #fff;
    color: var(--text);
    font: 500 13px Inter, Arial, sans-serif;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.buzon-field input,
.buzon-field select {
    min-height: 39px;
    padding: 7px 4px;
}

.buzon-field textarea {
    min-height: 82px;
    height: 82px;
    padding: 8px 4px;
    line-height: 1.45;
    resize: vertical;
}

.buzon-field input::placeholder,
.buzon-field textarea::placeholder {
    color: #8b969b;
    opacity: 1;
}

.buzon-field input:focus,
.buzon-field select:focus,
.buzon-field textarea:focus {
    border-bottom-color: var(--primary);
    box-shadow: 0 2px 0 var(--primary);
    background: #fcfefe;
}

.buzon-field select {
    appearance: none;
    cursor: pointer;
    padding-right: 28px;
    background-image: linear-gradient(45deg, transparent 50%, var(--primary) 50%), linear-gradient(135deg, var(--primary) 50%, transparent 50%);
    background-position: calc(100% - 12px) 17px, calc(100% - 7px) 17px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.counter {
    width: 100%;
    text-align: right;
    color: var(--muted);
    font-size: 9px;
    margin-top: 4px;
}

.buzon-form-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 16px;
}

.check {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    max-width: 68%;
    margin: 0 !important;
    color: var(--muted);
    font-size: 10px !important;
    font-weight: 500 !important;
    line-height: 1.45;
}

.check input {
    width: auto !important;
    flex: 0 0 auto;
    margin: 2px 0 0;
    accent-color: var(--primary);
}

.check span {
    display: block;
}

.submit {
    flex: 0 0 auto;
    border: 0;
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    padding: 11px 20px;
    font: 700 11px Inter, Arial, sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, transform .2s, box-shadow .2s;
}

.submit i {
    margin-left: 8px;
}

.submit:hover {
    background: var(--dark);
    transform: translateY(-1px);
    box-shadow: 0 7px 15px rgba(9, 55, 67, .18);
}

.form-note {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 9px;
    margin: 10px 0 0;
}

.form-note i {
    color: var(--primary);
}


/* 
   ANIMACIÓN DE ENVÍO DEL BUZÓN CIUDADANO
    */
.buzon-envio {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 24px;
    border-radius: 6px;
    background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.98), rgba(239,246,248,.96));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.buzon-envio.is-active {
    opacity: 1;
    visibility: visible;
}

.buzon-envio-scene {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

/* Durante la animación se muestra únicamente el sobre. */
.buzon-letter,
.buzon-mailbox,
.buzon-flight-trail,
.buzon-envio-text {
    display: none !important;
}

.buzon-envelope {
    position: absolute;
    width: min(360px, 70vw);
    aspect-ratio: 1.58 / 1;
    opacity: 0;
    transform: translate(0, 30px) scale(.55) rotate(-5deg);
    filter: drop-shadow(0 24px 25px rgba(9,55,67,.22));
    transform-origin: center center;
}

.buzon-envelope .envelope-back {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #ffffff, #edf5f6);
    border: 1px solid #cbdde1;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
    z-index: 1;
}

.buzon-envelope .envelope-paper {
    position: absolute;
    left: 9%;
    top: 7%;
    width: 82%;
    height: 73%;
    background: #fff;
    border: 1px solid #e0e7e9;
    border-radius: 3px;
    z-index: 2;
    transform: translateY(12%);
}

.buzon-envelope .envelope-paper::before,
.buzon-envelope .envelope-paper::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    height: 3px;
    border-radius: 3px;
    background: #e3eaec;
}

.buzon-envelope .envelope-paper::before { top: 34%; }
.buzon-envelope .envelope-paper::after { top: 49%; width: 58%; }

.buzon-envelope .envelope-flap {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 57%;
    background: linear-gradient(160deg, #f8fbfc, #dcebee);
    border: 1px solid #cbdde1;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: 50% 0;
    transform: rotateX(0deg);
    backface-visibility: hidden;
    z-index: 4;
}

.buzon-envelope .envelope-seal {
    position: absolute;
    left: 50%;
    top: 51%;
    width: 48px;
    height: 48px;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 17px;
    box-shadow: 0 7px 15px rgba(199,154,59,.32);
    z-index: 5;
}

.buzon-envio.is-active .buzon-envelope {
    animation: sobreEnviado 3.1s cubic-bezier(.2,.78,.18,1) forwards;
}

.buzon-envio.is-active .envelope-flap {
    animation: solapaSobre 3.1s ease-in-out forwards;
}

@keyframes sobreEnviado {
    0% {
        opacity: 0;
        transform: translate(0, 30px) scale(.55) rotate(-5deg);
    }
    12% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(-2deg);
    }
    43% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(-2deg);
    }
    100% {
        opacity: 0;
        transform: translate(520px, -170px) scale(.42) rotate(12deg);
    }
}

@keyframes solapaSobre {
    0%, 12% {
        transform: rotateX(0deg);
    }
    23% {
        transform: rotateX(180deg);
    }
    34%, 100% {
        transform: rotateX(0deg);
    }
}

@media (max-width: 700px) {
    .buzon-envio {
        padding: 15px;
    }

    .buzon-envelope {
        width: min(310px, 82vw);
    }

    @keyframes sobreEnviado {
        0% {
            opacity: 0;
            transform: translate(0, 25px) scale(.55) rotate(-5deg);
        }
        12% {
            opacity: 1;
            transform: translate(0, 0) scale(1) rotate(-2deg);
        }
        43% {
            opacity: 1;
            transform: translate(0, 0) scale(1) rotate(-2deg);
        }
        100% {
            opacity: 0;
            transform: translate(260px, -120px) scale(.42) rotate(12deg);
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .buzon-envio.is-active .buzon-envelope,
    .buzon-envio.is-active .envelope-flap {
        animation: none;
    }

    .buzon-envio.is-active .buzon-envelope {
        opacity: 1;
        transform: none;
    }

    .buzon-envio.is-active .envelope-flap {
        transform: none;
    }
}

/* Modal de confirmación existente */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 25, 30, .55);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 50;
}

.modal[hidden] {
    display: none;
}

.modal-box {
    background: #fff;
    border-radius: 18px;
    padding: 35px;
    width: min(500px, 100%);
    text-align: center;
    box-shadow: var(--shadow);
}

.success-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e9f5ef;
    color: #27784d;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: 800;
    margin: auto;
}

.modal-box h2 {
    font: 700 30px "Playfair Display", Georgia, serif;
}

.modal-box p {
    color: var(--muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 900px) {
    .buzon-section::before {
        top: 135px;
        height: 520px;
    }

    .buzon-layout {
        grid-template-columns: 250px minmax(0, 1fr);
    }

    .buzon-info {
        margin-right: -28px;
        padding: 25px 22px;
    }

    .buzon-info h3 {
        font-size: 23px;
    }

    .buzon-form {
        padding-left: 55px;
    }

    .buzon-form-bottom {
        align-items: flex-end;
    }
}

@media (max-width: 700px) {
    .buzon-section {
        padding-top: 35px;
        padding-bottom: 50px;
    }

    .buzon-section::before {
        display: none;
    }

    .buzon-layout {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .buzon-info {
        width: calc(100% - 24px);
        min-height: 0;
        margin: 0 0 -20px;
        padding: 23px;
        border-radius: 12px;
    }

    .buzon-info-icon {
        margin-bottom: 10px;
    }

    .buzon-info h3 {
        font-size: 24px;
    }

    .buzon-notice {
        margin-top: 16px;
    }

    .buzon-form {
        padding: 43px 21px 22px;
        border-radius: 12px;
    }

    .buzon-form-head {
        display: block;
    }

    .buzon-required {
        margin-top: 6px;
    }

    .buzon-fields {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .buzon-field-full,
    .buzon-field-message {
        grid-column: auto;
    }

    .buzon-form-bottom {
        display: block;
    }

    .check {
        max-width: 100%;
        margin-bottom: 14px !important;
    }

    .submit {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .buzon-intro h2 {
        font-size: 29px;
    }

    .buzon-info,
    .buzon-form {
        width: 100%;
    }

    .buzon-form {
        padding-left: 18px;
        padding-right: 18px;
    }
}
