/* BIN-BOI contact modal — form styles shared across pages */

/* Modal overlay */
#contact-modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
#contact-modal.modal-open {
    opacity: 1; pointer-events: auto;
}

#contact-modal-box {
    position: relative;
    width: 100%; max-width: 34rem;
    max-height: 90vh; overflow-y: auto;
    background: #141415;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}
#contact-modal.modal-open #contact-modal-box { transform: translateY(0) scale(1); }

/* Terminal-style chrome header */
#contact-modal-titlebar {
    position: sticky; top: 0; z-index: 2;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.85rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
#contact-modal-close {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 8px;
    border: 1px solid rgba(240, 120, 38, 0.4);
    color: rgba(240, 120, 38, 0.9);
    font-size: 14px; cursor: pointer;
    transition: all 0.2s ease;
}
#contact-modal-close:hover { background: rgba(240, 120, 38, 0.15); }

#contact-modal-body { padding: 1.5rem 1.25rem 1.5rem; }

/* Dot grid on modal background */
#contact-modal-box::before {
    content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0);
    background-size: 8px 8px;
    border-radius: 1.5rem;
}
#contact-modal-box > * { position: relative; z-index: 1; }

/* ------------------------------ FORM ------------------------------ */

.bb-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #f5f5f5;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.bb-input::placeholder { color: rgba(245, 245, 245, 0.3); }
.bb-input:hover { border-color: rgba(255, 255, 255, 0.2); }
.bb-input:focus {
    outline: none;
    border-color: rgba(240, 120, 38, 0.7);
    box-shadow: 0 0 0 3px rgba(240, 120, 38, 0.15);
    background: rgba(0, 0, 0, 0.35);
}
.bb-input[aria-invalid='true'] { border-color: rgba(240, 120, 38, 0.8); }

select.bb-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23F07826' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}
select.bb-input option { background: #1a1a1b; color: #f5f5f5; }
select.bb-input:invalid { color: rgba(245, 245, 245, 0.3); }
select.bb-input:valid { color: #f5f5f5; }

/* Field-level validation errors injected by Formspree */
[data-fs-error],
[data-fs-success] {
    display: none;
}
[data-fs-error]:not([data-fs-error=''])[data-fs-active] {
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #F07826;
    margin-top: 4px;
}

/* Success / error banners (shown via data-fs-active) */
[data-fs-success][data-fs-active],
[data-fs-error=''][data-fs-active] {
    display: block;
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
    font-family: 'Fira Code', monospace;
}
[data-fs-success][data-fs-active] {
    background: rgba(10, 147, 171, 0.1);
    border: 1px solid rgba(10, 147, 171, 0.4);
    color: #bfeef5;
}
[data-fs-error=''][data-fs-active] {
    background: rgba(240, 120, 38, 0.1);
    border: 1px solid rgba(240, 120, 38, 0.4);
    color: #ffd9bd;
}

/* ----------------------- MODAL LAYOUT (cm-*) ----------------------- */
/* These classes style the JS-injected template. They are plain CSS (not
   Tailwind utilities) so the modal renders correctly regardless of the
   compiled Tailwind build. */

.cm-backdrop { position: fixed; inset: 0; cursor: pointer; }
#contact-modal-box.cm-box { max-width: 34rem; }

.cm-titlebar { position: sticky; top: 0; z-index: 2; }
.cm-title {
    font-family: 'Fira Code', monospace;
    font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
    color: #F07826;
}
@media (min-width: 768px) { .cm-title { font-size: 12px; } }

.cm-body { padding: 1.5rem 1.25rem 1.5rem; }

.cm-heading {
    font-family: 'Archivo Black', sans-serif;
    font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.02em;
    color: #f5f5f5; margin: 0 0 0.25rem;
}
@media (min-width: 768px) { .cm-heading { font-size: 1.875rem; } }
.cm-accent { color: #F07826; }

.cm-sub {
    font-size: 0.75rem; color: rgba(245, 245, 245, 0.6);
    margin: 0 0 1.25rem;
}
@media (min-width: 768px) { .cm-sub { font-size: 0.875rem; } }

.cm-row { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 768px) { .cm-row { grid-template-columns: 1fr 1fr; } }

.cm-field-col { display: block; margin-bottom: 1rem; }
.cm-field-col:last-child { margin-bottom: 0; }
.cm-row .cm-field-col { margin-bottom: 0; }

.cm-label {
    display: block; margin-bottom: 0.5rem;
    font-family: 'Fira Code', monospace;
    font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(245, 245, 245, 0.6);
}

.cm-textarea { resize: vertical; min-height: 6rem; }

.cm-status { display: none; }
.cm-status.cm-success,
.cm-status.cm-error { display: none; }
[data-fs-success][data-fs-active].cm-success,
[data-fs-error=''][data-fs-active].cm-error { display: block; }
.cm-error-accent { color: #F07826; }
.cm-link { color: #F07826; text-decoration: underline; text-underline-offset: 2px; }

.cm-footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-top: 1.25rem;
    /* hidden on small screens to preserve the sticky bottom CTA */
}
@media (max-width: 640px) { .cm-footer { flex-direction: column; align-items: stretch; } }

.cm-hint {
    font-family: 'Fira Code', monospace; font-size: 10px;
    color: rgba(245, 245, 245, 0.45);
}
@media (max-width: 640px) { .cm-hint { display: none; } }

.cm-btn {
    display: inline-flex; align-items: center; gap: 0.75rem;
    background: #F07826;
    color: #1a1a1b;
    font-family: 'Fira Code', monospace; font-weight: 700;
    font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
    padding: 0.875rem 1.5rem; border-radius: 0.75rem;
    cursor: pointer; user-select: none;
    transition: all 0.3s ease;
    border: none;
}
@media (min-width: 768px) { .cm-btn { font-size: 14px; padding: 0.875rem 2rem; } }
.cm-btn:hover:not(:disabled) {
    background: rgba(240, 120, 38, 0.9);
    box-shadow: 0 0 30px rgba(240, 120, 38, 0.4);
}
.cm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cm-btn:focus-visible { outline: 2px solid #0A93AB; outline-offset: 2px; }

.cm-spinner {
    display: inline-block; width: 1rem; height: 1rem;
    border: 2px solid rgba(26, 26, 27, 0.3);
    border-top-color: #1a1a1b;
    border-radius: 50%;
    animation: cm-spin 0.7s linear infinite;
}
.cm-spinner[hidden] { display: none; }
@keyframes cm-spin { to { transform: rotate(360deg); } }

.cm-btn-arrow { display: inline-block; transition: transform 0.3s ease; }
.cm-btn:hover .cm-btn-arrow { transform: translateX(4px); }

/* Honeypot — visually hidden from humans, present for bots */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px; height: 1px; overflow: hidden;
}

#contact-modal.modal-closed { display: none; }

@media (max-width: 640px) {
    #contact-modal { padding: 0.5rem; }
    #contact-modal-box { max-height: 95vh; }
}
