/* =============================================================
   Contact page
   Built on the shared design tokens (variables.css) + the
   story-arc / accent-hue system. The form is genuinely new UI
   (no form component exists in the codebase), so these styles
   theme the base input rules from base.css rather than
   reinventing a card system.
   ============================================================= */

.contact-arc { padding-top: var(--space-2xl); }

/* Two-column: invitation aside · form card */
.contact-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: var(--space-4xl);
    align-items: start;
}

/* ── Left: invitation + direct channels + reassurance ───────── */
.contact-aside { padding-top: var(--space-md); }

.contact-eyebrow {
    margin: 0 0 var(--space-md);
    font-size: var(--text-sm);
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-primary);
}

.contact-aside h2 {
    font-size: clamp(2rem, 3.6vw, 3rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-lg);
}

.contact-aside .lead {
    font-size: var(--text-lg);
    line-height: 1.6;
    color: var(--color-text-secondary);
    max-width: 42ch;
    margin: 0 0 var(--space-2xl);
}

/* Direct contact channels */
.contact-channels {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin: 0 0 var(--space-2xl);
    padding: 0;
}

.contact-channel {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-elevated);
    transition: border-color var(--transition-base), transform var(--transition-base);
}

.contact-channel:hover {
    border-color: var(--color-primary);
    transform: translateY(-1px);
    color: var(--color-text);
}

.contact-channel__icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--color-primary) 14%, transparent);
    color: var(--color-primary);
}

.contact-channel__icon svg { width: 20px; height: 20px; }

.contact-channel__meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.contact-channel__label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.contact-channel__value {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reassurance checklist */
.contact-reassure {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin: 0;
    padding: 0;
}
.contact-reassure li {
    position: relative;
    padding-left: calc(var(--space-lg) + var(--space-sm));
    color: var(--color-text-secondary);
    font-weight: 500;
    line-height: 1.5;
}
/* checkmark stroke is the brand orange — identical to --color-primary (#FF791B)
   in both theme-dark and theme-light, so the literal here tracks the token */
.contact-reassure li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--color-primary) 16%, transparent)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF791B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.contact-reassure strong { color: var(--color-text); font-weight: 800; }

/* ── Right: the form card ───────────────────────────────────── */
.contact-card {
    position: relative;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-3xl);
    box-shadow: 0 24px 60px -30px rgba(3, 3, 6, 0.28);
}

.contact-card__title {
    font-size: var(--text-2xl);
    font-weight: 900;
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-xs);
}
.contact-card__sub {
    margin: 0 0 var(--space-2xl);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

.contact-form { display: grid; gap: var(--space-lg); }

/* Name row: two-up on desktop, stacks on mobile */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.field { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }

.field > label {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}
.field .req { color: var(--color-primary); font-weight: 900; }
.field .opt {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

/* Inputs — inherit base.css, refine radius / padding / brand focus ring */
.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: 13px 16px;
    font-size: var(--text-base);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--color-text-muted); }

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent);
    background: var(--color-surface-elevated);
}

/* Auto-growing message field: JS sets the height to fit content, so the text
   never scrolls until it hits the generous cap. resize:none because the script
   owns the height. */
.contact-form textarea {
    min-height: 148px;
    resize: none;
    overflow-y: auto;
    line-height: 1.6;
}

/* Custom select chevron */
.select-wrap { position: relative; }
.select-wrap::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 11px;
    height: 11px;
    transform: translateY(-60%) rotate(45deg);
    border-right: 2px solid var(--color-text-muted);
    border-bottom: 2px solid var(--color-text-muted);
    pointer-events: none;
}
.contact-form select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 44px;
    cursor: pointer;
}

/* Invalid state (set by JS via aria-invalid) */
.contact-form [aria-invalid="true"] {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.16);
}
/* role="alert" — kept in the accessibility tree so injected text is announced.
   When empty it's visually hidden (clipped, not display:none) and pulled out of
   flow so it adds no gap under the input. */
.field__error {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-danger-text);
}
.field__error:empty {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Honeypot — kept in the layout flow but pushed fully off-screen and
   hidden from AT + tab order. Real users never see or focus it. */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Submit + fine print */
.contact-submit { margin-top: var(--space-sm); }
.contact-form .btn--primary {
    width: 100%;
    margin-bottom: 0;
    padding: 15px 24px;
    font-size: var(--text-base);
}
/* Center the arrow icon with the label text */
.contact-form .btn-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.contact-form .btn-label svg { display: block; }
.contact-form .btn--primary[disabled] { opacity: 0.7; cursor: progress; }

.btn-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.25);
    border-top-color: rgba(0, 0, 0, 0.85);
    animation: contact-spin 0.7s linear infinite;
    display: none;
}
.is-sending .btn-label { display: none; }
.is-sending .btn-spinner { display: inline-block; }
@keyframes contact-spin { to { transform: rotate(360deg); } }

.form-note {
    margin: var(--space-md) 0 0;
    font-size: var(--text-xs);
    line-height: 1.6;
    color: var(--color-text-muted);
}
.form-note a { color: var(--color-text-secondary); text-decoration: underline; }
.form-note a:hover { color: var(--color-primary); }

/* Server-error banner */
.form-alert {
    display: none;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    background: rgba(229, 72, 77, 0.10);
    border: 1px solid rgba(229, 72, 77, 0.35);
    color: var(--color-danger-text);
    font-size: var(--text-sm);
    font-weight: 600;
}
.form-alert.is-visible { display: flex; }

/* ── Success state (replaces the form on success) ───────────── */
.contact-success {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
}
.contact-success.is-visible { display: flex; }
.contact-success__badge {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--color-success) 18%, transparent);
    color: var(--color-success);
    margin-bottom: var(--space-lg);
    animation: contact-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.contact-success__badge svg { width: 34px; height: 34px; }
.contact-success h3 { font-size: var(--text-2xl); margin: 0 0 var(--space-sm); }
.contact-success p { color: var(--color-text-secondary); max-width: 40ch; margin: 0; }
@keyframes contact-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Respect reduced-motion: no spin, no pop — the states still appear, just static */
@media (prefers-reduced-motion: reduce) {
    .btn-spinner { animation: none; }
    .contact-success__badge { animation: none; }
}

/* ── Bottom reassurance strip ───────────────────────────────── */
.contact-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
    margin-top: var(--space-3xl);
}
.contact-strip__item {
    padding: var(--space-xl);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-elevated);
}
.contact-strip__item h4 { font-size: var(--text-lg); font-weight: 800; margin: 0 0 var(--space-xs); }
.contact-strip__item p { font-size: var(--text-sm); color: var(--color-text-secondary); margin: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 960px) {
    .contact-layout { grid-template-columns: 1fr; gap: var(--space-3xl); }
    .contact-strip { grid-template-columns: 1fr; gap: var(--space-md); }
}

@media (max-width: 560px) {
    .form-row { grid-template-columns: 1fr; }
    .contact-card { padding: var(--space-xl); }
}
