/*
contact-modal.css
Role: contact form modal styles.
Responsibility: layout and presentation of the contact overlay.
Note: Modify only from the latest local file.
*/

.contact-modal[hidden] { display: none; }

/* Popover (consistent with the settings panel): no backdrop, app stays interactive.
   The fixed full-viewport layer must NOT block clicks — only the panel captures them. */
.contact-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
}

/* Backdrop removed for the popover model — kept as a no-op so the markup needn't change. */
.contact-modal-backdrop {
    display: none;
}

/* Anchor the panel BELOW the contact icon (same pattern as the settings panel) — JS sets the
   top/left vars from the trigger's rect on open. Falls back to a sane top-left if unset. */
.contact-modal-panel {
    position: fixed;
    top: var(--contact-panel-top, 86px);
    left: var(--contact-panel-left, 22px);
    z-index: 1;
    pointer-events: auto;   /* re-enable on the panel (parent layer is pointer-events:none) */
    /* width is the shared .settings-panel,.contact-modal-panel rule in base.css */
    box-sizing: border-box;
    max-height: calc(100vh - var(--contact-panel-top, 86px) - 16px);
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-float);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Phone: full-width sheet flush to the header's bottom edge (top anchored to --topbar-h), top
   corners squared, bottom rounded — overrides the JS-set anchor top/left + the shared min(365px)
   width. Defined HERE, not base.css, so it wins over the `left/top: var(--contact-panel-*)` above
   (same file). Matches settings. Keyed off html[data-phone-mode] so the phone breakpoint has ONE
   home (the setPhoneMode matchMedia in shared_ui.js). */
html[data-phone-mode] .contact-modal-panel {
    top: var(--topbar-h, 56px);
    left: 0;
    right: 0;
    width: auto;
    transform: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.contact-modal-title {
    font-size: var(--text-panel);
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.contact-modal-close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}
.contact-modal-close:hover { color: var(--text); }

.contact-modal-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.contact-modal-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contact-modal-input,
.contact-modal-textarea {
    background: var(--input-bg, var(--bg));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: var(--text-ui);
    padding: 8px var(--space-sm);
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
    font-family: inherit;
}
/* Phone: 16px font prevents iOS auto-zoom-on-focus (which never restores on blur). Keyed off
   html[data-phone-mode] so the phone breakpoint has ONE home (shared_ui.js setPhoneMode). */
html[data-phone-mode] .contact-modal-input,
html[data-phone-mode] .contact-modal-textarea { font-size: 16px; }
.contact-modal-input:focus,
.contact-modal-textarea:focus {
    outline: none;
    border-color: var(--accent, #3b82f6);
}

.contact-modal-textarea {
    resize: vertical;
    min-height: 110px;
}

.contact-modal-honeypot {
    display: none;
}

.contact-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.contact-modal-status {
    font-size: var(--text-sm);
    color: var(--muted);
    flex: 1;
    min-width: 0;
}
.contact-modal-status.is-error { color: var(--market-down, #ef4444); }
.contact-modal-status.is-ok    { color: var(--market-up, #22c55e); }

.contact-modal-submit {
    flex-shrink: 0;
}

/* Prevent iOS Safari focus auto-zoom: these inputs use --text-ui (~14.4px), below
   the 16px threshold. Force 16px on phone only; desktop keeps the smaller size. */
@media (max-width: 820px) {
    .contact-modal-input,
    .contact-modal-textarea {
        font-size: 1rem;
    }
}
