﻿/* ========================================
   HOMEPAGE COMPONENTS — Reusable Elements
   Header, Progress, Navigation, Spinner,
   Go-Back button.

   Design tokens are loaded by the layout before
   this file — no @import needed here.
======================================== */

/* ====== ACCESSIBILITY UTILITIES ====== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ====== HEADER COMPONENT ====== */

.homepage-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--height-header);
    background: var(--color-white);
    padding: var(--spacing-md) var(--spacing-xxl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
    z-index: var(--z-header);
}

.homepage-header-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-lg);
    flex: 1;
}

.homepage-header-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-xl);
}

.homepage-logo {
    height: var(--spacing-md);
}

.homepage-contact-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.homepage-contact-label {
    font-family: var(--font-primary);
    font-size: var(--font-size-disclaimer);
    line-height: var(--line-height-disclaimer);
    color: var(--color-neutral-dg-60);
    text-align: right;
}

.homepage-contact-number {
    font-family: var(--font-primary);
    font-size: var(--font-size-disclaimer);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-disclaimer);
    color: var(--color-neutral-dg-60);
    text-align: right;
    letter-spacing: var(--letter-spacing-normal);
}

.homepage-phone-icon {
    width: var(--spacing-lg);
    height: var(--spacing-lg);
}

/* ====== PROGRESS INDICATOR (homepage / side-by-side layout) ====== */

.homepage-progress {
    position: fixed;
    top: var(--height-header);
    left: 0;
    width: 100%;
    height: var(--height-progress-bar);
    background: var(--color-neutral-mg-30);
    z-index: calc(var(--z-header) - 1);
}

.homepage-progress-bar {
    height: 100%;
    background: var(--gradient-logo);
    transition: width 0.3s ease;
}

/* ====== NAVIGATION BREADCRUMB ====== */

.homepage-breadcrumb {
    position: sticky;
    top: var(--height-header-total);
    background: transparent;
    z-index: calc(var(--z-header) - 2);
    padding: var(--spacing-sm) 0;
}

.homepage-breadcrumb-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    color: var(--color-secondary-blue);
    font-family: var(--font-primary);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-caption);
    transition: all 0.2s ease;
}

    .homepage-breadcrumb-link:hover {
        color: var(--color-primary-blue);
        text-decoration: underline;
    }

.homepage-breadcrumb-icon {
    width: 80px;
    height: var(--line-height-caption);
    margin-right: 0;
}

/* ====== LOADING SPINNER ====== */

.homepage-spinner {
    display: inline-block;
    width: var(--spacing-lg);
    height: var(--spacing-lg);
    border: 2px solid var(--color-neutral-mg-30);
    border-radius: var(--radius-round);
    border-top-color: var(--color-primary-blue);
    animation: spin 1s linear infinite;
}



@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ====== RESPONSIVE HEADER — canonical breakpoints ====== */

/* Mobile 768px */
@media (max-width: 768px) {
    .homepage-header {
        padding: var(--spacing-sm) var(--spacing-md);
        gap: var(--spacing-md);
    }

    .homepage-header-right {
        gap: var(--spacing-md);
    }

    /* Hide text contact info on mobile — phone icon stays */
    .homepage-contact-info {
        display: none;
    }
}

/* Small mobile 480px */
@media (max-width: 480px) {
    .homepage-header-right {
        gap: var(--spacing-sm);
    }
}

/* ====== ACCESSIBILITY ====== */
/* .visually-hidden / .homepage-visually-hidden are defined in design-tokens.css */

/* Focus styles for keyboard navigation */
.homepage-main-button:focus,
.homepage-breadcrumb-link:focus {
    outline: 2px solid var(--color-primary-blue);
    outline-offset: 2px;
}

/* ---- High contrast ---- */
@media (prefers-contrast: high) {
    .homepage-container {
        background: var(--color-white);
    }

    .homepage-title,
    .homepage-subtitle {
        color: var(--color-neutral-dg-80);
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {

    .homepage-main-button,
    .homepage-breadcrumb-link,
    .homepage-spinner {
        transition: none;
        animation: none;
    }
}

/* ========================================
   GO BACK BUTTON
   Positioned inside .main-content-area (position:relative).
   Uses --height-header-total token so it always clears the
   fixed header exactly — no magic numbers needed.
======================================== */
.sticky-goback {
    /* Sit at top-left of the content area, not overlapping header */
    position: sticky;
    top: var(--spacing-md);  /* 16px breathing room from scroll container top */
    left: 0;
    z-index: var(--z-back-button);
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-xl); /* 8px 32px */
    pointer-events: none; /* let container pass clicks through to content */
}

.goback-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--color-primary-blue);
    font-family: var(--font-primary);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-paragraph); /* 16px */
    line-height: var(--line-height-paragraph);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    pointer-events: all; /* re-enable clicks on the link itself */
    transition: color 0.2s ease;
    letter-spacing: var(--letter-spacing-normal);
}

    .goback-link:hover {
        color: var(--color-primary-blue-hover);
        text-decoration: underline;
    }

    .goback-link:focus-visible {
        outline: 2px solid var(--color-primary-blue);
        outline-offset: 2px;
        border-radius: var(--radius-sm);
    }

.goback-icon {
    /* Icon SVG is designed at 100px wide — preserve that on desktop */
    width: 100px;
    height: auto;
    flex-shrink: 0;
}

/* ---- Mobile 768px ---- */
@media (max-width: 768px) {
    .sticky-goback {
        padding: var(--spacing-sm) var(--spacing-md); /* tighter side padding */
    }

    .goback-link {
        font-size: var(--font-size-caption); /* 14px */
        line-height: var(--line-height-caption);
    }

    .goback-icon {
        width: 48px;
    }
}

/* ---- Small mobile 480px ---- */
@media (max-width: 480px) {
    .sticky-goback {
        padding: var(--spacing-xs) var(--spacing-md);
    }

    .goback-link {
        font-size: var(--font-size-disclaimer); /* 12px */
        line-height: var(--line-height-disclaimer);
    }

    .goback-icon {
        width: 32px;
    }
}
