/**
 * Contact Page Styles
 *
 * Styling for the contact page including form, map, and layout.
 * All values use design system tokens — no hardcoded colours, fonts, or spacing.
 *
 * @package Strand_House
 * @since 1.0.0
 */

/* ==========================================================================
   CONTACT PAGE CONTAINER
   ========================================================================== */

.contact-page {
    background-color: var(--color-cream);
    padding: 0;
}

.contact-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-5);
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */

.contact-header {
    text-align: left;
    max-width: 56ch;
    margin-bottom: var(--space-8);
}

.contact-eyebrow {
    margin-bottom: var(--space-4);
}

.contact-title {
    font-family: var(--font-display);
    font-size: var(--fs-display-2);
    font-weight: var(--fw-display);
    line-height: var(--lh-display);
    letter-spacing: var(--ls-display);
    color: var(--color-dark-brown);
    margin: 0 0 var(--space-5) 0;
}

.contact-title-accent {
    color: var(--color-clay);
}

.contact-subtitle {
    font-family: var(--font-body);
    font-size: var(--fs-body-lg);
    font-weight: var(--fw-body);
    color: var(--color-dark-brown);
    margin: 0;
    line-height: var(--lh-body);
}

/* ==========================================================================
   GRID LAYOUT
   ========================================================================== */

.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-7);
}

@media (min-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-8);
    }
}

/* ==========================================================================
   CONTACT FORM
   ========================================================================== */

.contact-form {
    margin-bottom: var(--space-8);
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-group:last-of-type {
    margin-bottom: 0;
}

/* Form Labels */
.contact-form .form-label {
    display: block;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: 500;
    color: var(--color-dark-brown);
    margin-bottom: var(--space-3);
}

/* Text Inputs & Textarea */
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%;
    padding: var(--space-4) 0;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: 400;
    color: var(--color-dark-brown);
    background-color: transparent;
    border: none;
    border-bottom: 1px solid var(--color-dark-brown);
    border-radius: 0;
    outline: none;
    transition: border-color var(--dur-1) var(--ease-soft);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: var(--color-ink-50);
}

/* Soft focus — doubled bottom edge via shadow (no layout shift). Spec-correct
   :focus-visible fires on mouse click for text inputs, so the indicator must
   be subtle. */
.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
    border-bottom-color: var(--color-dark-brown);
    box-shadow: 0 1px 0 var(--color-dark-brown);
    outline: none;
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
    font-family: var(--font-body);
}

/* ==========================================================================
   CUSTOM DROPDOWN (Accordion Style)
   ========================================================================== */

.custom-dropdown {
    position: relative;
}

.dropdown-toggle {
    width: 100%;
    padding: var(--space-4) 0;
    font-family: var(--font-label);
    font-size: var(--fs-body-sm);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    color: var(--color-gray-soft);
    background-color: transparent;
    border: none;
    border-bottom: 1px solid var(--color-dark-brown);
    border-radius: 0;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color var(--dur-1) var(--ease-soft);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.dropdown-toggle:hover {
    color: var(--color-dark-brown);
}

.dropdown-toggle:focus-visible {
    outline: 2px solid var(--color-dark-brown);
    outline-offset: 2px;
    color: var(--color-dark-brown);
}

.dropdown-toggle.active .dropdown-selected {
    color: var(--color-dark-brown);
}

.dropdown-selected {
    flex: 1;
}

.dropdown-arrow {
    width: var(--space-4);
    height: var(--space-4);
    transition: transform var(--dur-2) var(--ease-soft);
    flex-shrink: 0;
}

.dropdown-toggle[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-cream);
    border-bottom: 1px solid var(--color-dark-brown);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    /* visibility:hidden keeps the collapsed options out of the tab order and
       the accessibility tree; the delayed visibility transition lets it stay
       visible through the close animation, then hides. */
    visibility: hidden;
    transition: max-height var(--dur-2) var(--ease-soft),
                opacity var(--dur-2) var(--ease-soft),
                padding var(--dur-2) var(--ease-soft),
                visibility 0s linear var(--dur-2);
    z-index: 10;
}

.dropdown-menu.active {
    max-height: 300px;
    opacity: 1;
    padding: 8px 0;
    visibility: visible;
    transition-delay: 0s;
}

.dropdown-option {
    width: 100%;
    padding: var(--space-3) 0;
    font-family: var(--font-label);
    font-size: var(--fs-body);
    font-weight: 400;
    color: var(--color-dark-brown);
    background-color: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--dur-1) var(--ease-soft);
}

.dropdown-option:hover {
    background-color: var(--color-ink-08);
}

.dropdown-option:focus-visible {
    outline: 2px solid var(--color-dark-brown);
    outline-offset: 2px;
    background-color: var(--color-ink-08);
}

/* ==========================================================================
   SUBMIT BUTTON
   ========================================================================== */

/* Submit button uses the design-system outlined pill (.button-primary);
   only the trailing arrow needs local treatment. */
.contact-submit {
    gap: var(--space-3);
    flex-shrink: 0;
}

.submit-arrow {
    width: 16px;
    height: 16px;
    transition: transform var(--dur-2) var(--ease-soft);
}

.contact-submit:hover .submit-arrow {
    transform: translateX(4px);
}

/* Spam control + submit on one row */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-4);
}

/* ==========================================================================
   FORM MESSAGES
   ========================================================================== */

.form-message {
    margin-top: var(--space-5);
    padding: var(--space-4);
    border-radius: var(--radius-input);
    font-family: var(--font-body);
    font-size: var(--fs-body-sm);
    display: none;
}

.form-message.success {
    display: block;
    background-color: color-mix(in srgb, var(--color-success) 10%, transparent);
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

.form-message.error {
    display: block;
    background-color: color-mix(in srgb, var(--color-error) 10%, transparent);
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

/* ==========================================================================
   CONTACT DETAILS
   ========================================================================== */

.contact-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-ink-20);
}

@media (min-width: 768px) {
    .contact-footer {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-8);
    }
}

.contact-footer-label {
    font-family: var(--font-label);
    font-size: var(--fs-label);
    font-weight: var(--fw-label);
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    color: var(--color-dark-brown);
    margin: 0 0 var(--space-3);
}

.contact-footer-value {
    font-family: var(--font-body);
    font-size: var(--fs-body-lg);
    font-weight: var(--fw-body);
    color: var(--color-dark-brown);
    line-height: var(--lh-body);
    margin: 0;
}

.contact-footer-value a {
    color: var(--color-dark-brown);
    text-decoration: none;
    transition: color var(--dur-1) var(--ease-soft);
}

.contact-footer-value a:hover {
    color: var(--color-clay);
}

/* ==========================================================================
   MAP SECTION
   ========================================================================== */

.contact-map-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.contact-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
    background-color: var(--color-cream-dark);
    border-radius: var(--radius-none);
    overflow: hidden;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

/* Leaflet container */
.contact-map .leaflet-container {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-none);
    font-family: var(--font-body);
}

/* Leaflet popup styling */
.contact-map .leaflet-popup-content-wrapper {
    background-color: var(--color-cream);
    color: var(--color-dark-brown);
    font-family: var(--font-body);
    border-radius: var(--radius-input);
    box-shadow: 0 2px 8px var(--color-ink-20);
}

.contact-map-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-5);
    text-align: center;
    background-color: var(--color-cream);
    font-family: var(--font-body);
    color: var(--color-dark-brown);
}

.contact-map .leaflet-popup-content {
    margin: var(--space-3);
    font-size: var(--fs-label);
    line-height: 1.4;
}

.contact-map .leaflet-popup-tip {
    background-color: var(--color-cream);
}

/* Leaflet zoom controls */
.contact-map .leaflet-control-zoom a {
    background-color: var(--color-cream);
    color: var(--color-dark-brown);
    border: 1px solid var(--color-dark-brown);
}

.contact-map .leaflet-control-zoom a:hover {
    background-color: var(--color-dark-brown);
    color: var(--color-cream);
}

/* Leaflet attribution */
.contact-map .leaflet-control-attribution {
    background-color: color-mix(in srgb, var(--color-cream) 90%, transparent);
    font-size: var(--fs-label);
}

.contact-map .leaflet-control-attribution a {
    color: var(--color-dark-brown);
}

/* Leaflet map tile tint */
.map-tiles {
    filter: sepia(0.25) saturate(0.6) brightness(1.05) contrast(0.95);
}

/* Custom map marker */
.custom-map-marker {
    position: relative;
}

.marker-pin-classic {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 42px;
}

.pin-top {
    width: 30px;
    height: 30px;
    background-color: var(--color-cream);
    border: 3px solid var(--color-dark-brown);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 0 2px 8px var(--color-ink-20);
}

.pin-bottom {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 12px solid var(--color-dark-brown);
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Open Maps Button */
.open-maps-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0;
    margin-top: var(--space-5);
    margin-left: auto;
    font-family: var(--font-label);
    font-size: var(--fs-label);
    font-weight: var(--fw-label);
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    color: var(--color-dark-brown);
    background-color: transparent;
    border: none;
    text-decoration: none;
    transition: color var(--dur-2) var(--ease-soft);
}

.open-maps-btn {
    position: relative;
}

/* Touch target — invisible 44px hit area */
.open-maps-btn::after {
    content: "";
    position: absolute;
    inset: -13px 0;
}

.open-maps-btn:hover {
    color: var(--color-clay);
}

.open-maps-btn:focus-visible {
    outline: 2px solid var(--color-dark-brown);
    outline-offset: 2px;
}

.maps-arrow {
    width: 16px;
    height: 16px;
    transition: transform var(--dur-2) var(--ease-soft);
}

.open-maps-btn:hover .maps-arrow {
    transform: translateX(4px);
}

/* ==========================================================================
   PRIVACY NOTE
   ========================================================================== */

.form-privacy-note {
    font-family: var(--font-body);
    font-size: var(--fs-label);
    color: var(--color-dark-gray);
    margin-top: 0;
    margin-bottom: var(--space-3);
}

.form-privacy-note a {
    color: var(--color-dark-gray);
    text-decoration: underline;
}

.form-privacy-note a:hover {
    color: var(--color-charcoal);
}

/* ==========================================================================
   HONEYPOT (spam prevention)
   ========================================================================== */

.honeypot {
    display: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 767px) {
    .contact-container {
        padding: var(--space-7) var(--space-5);
    }

    .contact-header {
        margin-bottom: var(--space-7);
    }

    .contact-form {
        margin-bottom: var(--space-7);
    }

    /* Stack spam control above the submit button on narrow screens */
    .form-actions {
        flex-wrap: wrap;
        gap: var(--space-4);
    }

    .form-group-altcha altcha-widget {
        white-space: normal;
    }

    /* Mobile: Edge-to-edge map with reduced height */
    .contact-right {
        margin-left: calc(-1 * var(--space-5));
        margin-right: calc(-1 * var(--space-5));
        margin-bottom: var(--space-8);
    }

    .contact-map-wrapper {
        min-height: 350px;
    }

    .contact-map {
        min-height: 350px;
        border-radius: var(--radius-none);
    }

    .contact-map .leaflet-container {
        border-radius: var(--radius-none);
    }
}

/* ==========================================================================
   REDUCED MOTION SUPPORT
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .dropdown-toggle,
    .dropdown-option,
    .dropdown-menu,
    .dropdown-arrow,
    .contact-submit,
    .submit-arrow,
    .open-maps-btn,
    .maps-arrow,
    .form-message,
    .contact-form input[type="text"],
    .contact-form input[type="email"],
    .contact-form textarea,
    .contact-footer-value a {
        animation-duration: 0.01ms;
        transition-duration: 0.01ms;
    }
}

/* Marketing opt-in checkbox — sized to match the ALTCHA widget's own
   checkbox (.altcha-checkbox input is 18px) so the two read as one family. */
.form-group-subscribe .checkbox-label {
    align-items: flex-start;
    gap: var(--space-2);
    /* ALTCHA's own checkbox sits inset by its widget's .7rem padding
       (.altcha-main). Match that inset so both checkboxes line up. */
    padding-left: var(--space-3);
}

.form-group-subscribe input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    flex-shrink: 0;
}

/* ALTCHA widget — restyled as a borderless checkbox + label to match the
   contact mockup. Functionality (proof-of-work) is unchanged; this is purely
   the widget's own theming via its CSS custom properties. */
.form-group-altcha {
    display: flex;
    align-items: center;
}

.form-group-altcha .altcha-widget-wrap {
    margin-bottom: 0 !important;
}

.form-group-altcha altcha-widget {
    --altcha-border-width: 0;
    --altcha-border-radius: var(--radius-xs);
    --altcha-max-width: none;
    --altcha-color-base: transparent;
    --altcha-color-border: var(--color-dark-brown);
    --altcha-color-text: var(--color-dark-brown);
    --altcha-color-border-focus: var(--color-dark-brown);
    display: inline-block;
    font-family: var(--font-body);
    font-size: var(--fs-body-sm);
    white-space: nowrap;
}
