/* =====================================================================
   [T-103] Airdrie Mediation Services — Bespoke design layer
   Tailwind (CDN) handles layout/utilities; this file holds the premium
   micro-interaction primitives Tailwind can't express inline.
   ===================================================================== */

:root {
    --brand-600: #02537E;   /* primary — from original site theme-color */
    --brand-500: #036CA2;
    --brand-700: #01476D;
    --brand-800: #013350;
    --navy: #1D426C;        /* sampled from the original logo */
    --ivory: #F8F6F1;
    --ink: #0E1E2E;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem;
    -webkit-text-size-adjust: 100%;
}

body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(3, 108, 162, 0.18);
    color: var(--brand-800);
}

:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ---------- [T-103] Scroll reveal (fade + slide up) ----------
   Only hidden when JS is confirmed running (html.js), so content
   is always visible to crawlers / no-JS visitors. */
.js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
    transition:
        opacity 0.9s var(--ease-out-expo),
        transform 1.1s var(--ease-out-expo);
    transition-delay: var(--d, 0ms);
    will-change: opacity, transform;
}
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="left"] { transform: translate3d(-28px, 0, 0); }
.js [data-reveal="right"] { transform: translate3d(28px, 0, 0); }
.js [data-reveal="scale"] { transform: scale(0.96); }
.js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Header glass state ---------- */
.site-header { transition: background-color .5s var(--ease-out-expo), box-shadow .5s var(--ease-out-expo), padding .5s var(--ease-out-expo); }
.site-header.is-scrolled {
    background-color: rgba(248, 246, 241, 0.78);
    box-shadow: 0 1px 0 rgba(14, 30, 46, 0.06), 0 18px 40px -24px rgba(1, 51, 80, 0.25);
}
.nav-link { position: relative; }
.nav-link::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -6px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .5s var(--ease-out-expo);
}
.nav-link:hover::after,
.nav-link.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav-link.is-active { color: var(--brand-600); }

/* ---------- Mobile menu ---------- */
.mobile-menu { visibility: hidden; opacity: 0; transition: opacity .45s var(--ease-out-expo), visibility 0s linear .45s; }
.mobile-menu.is-open { visibility: visible; opacity: 1; transition: opacity .45s var(--ease-out-expo); }
.mobile-menu .mobile-link { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease-out-expo), transform .6s var(--ease-out-expo); }
.mobile-menu.is-open .mobile-link { opacity: 1; transform: none; }
.mobile-menu.is-open .mobile-link:nth-child(2) { transition-delay: 60ms; }
.mobile-menu.is-open .mobile-link:nth-child(3) { transition-delay: 120ms; }
.mobile-menu.is-open .mobile-link:nth-child(4) { transition-delay: 180ms; }
.mobile-menu.is-open .mobile-link:nth-child(5) { transition-delay: 240ms; }
.mobile-menu.is-open .mobile-link:nth-child(6) { transition-delay: 300ms; }
.mobile-menu.is-open .mobile-link:nth-child(7) { transition-delay: 360ms; }

/* ---------- Textures & shapes ---------- */
.grain::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .5;
    mix-blend-mode: soft-light;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.arch { border-radius: 999px 999px 28px 28px; }
.text-balance { text-wrap: balance; }
.text-pretty { text-wrap: pretty; }

.spin-slow { animation: spin 38s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.float-soft { animation: floatSoft 7s ease-in-out infinite; }
@keyframes floatSoft { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* Button sheen */
.btn-sheen { position: relative; overflow: hidden; isolation: isolate; }
.btn-sheen::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform .9s var(--ease-out-expo);
}
.btn-sheen:hover::before { transform: translateX(120%); }

/* ---------- [T-106] Process timeline progress ---------- */
.timeline-fill {
    transform-origin: top;
    transform: scaleY(var(--progress, 0));
    transition: transform .2s linear;
}
.timeline-node { transition: background-color .6s var(--ease-out-expo), color .6s var(--ease-out-expo), box-shadow .6s var(--ease-out-expo), border-color .6s var(--ease-out-expo); }
.is-visible .timeline-node {
    background-color: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
    box-shadow: 0 0 0 8px rgba(3, 108, 162, 0.12);
}

/* ---------- [T-109] Floating-label form fields & no-JS fallback ---------- */
.no-js #contactForm { display: none; }
#contactFallback { display: none; }
#contactFallback:target { display: block; }
.field { position: relative; }
.field-input {
    width: 100%;
    padding: 1.6rem 1.1rem 0.6rem;
    border-radius: 14px;
    border: 1px solid rgba(14, 30, 46, 0.12);
    background: rgba(255, 255, 255, 0.75);
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color .3s ease, box-shadow .3s ease, background-color .3s ease;
    appearance: none;
    -webkit-appearance: none;
}
.field-input:hover { border-color: rgba(2, 83, 126, 0.35); }
.field-input:focus {
    outline: none;
    border-color: var(--brand-500);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(3, 108, 162, 0.14);
}
.field-label {
    position: absolute;
    left: 1.1rem;
    top: 1.12rem;
    color: rgba(14, 30, 46, 0.55);
    font-size: 1rem;
    pointer-events: none;
    transform-origin: left top;
    transition: transform .3s var(--ease-out-expo), color .3s ease;
}
.field-input:focus + .field-label,
.field-input:not(:placeholder-shown) + .field-label,
select.field-input + .field-label {
    transform: translateY(-0.62rem) scale(0.76);
    color: var(--brand-600);
    font-weight: 600;
    letter-spacing: .02em;
}
textarea.field-input { min-height: 9.5rem; resize: vertical; }
select.field-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2302537E' stroke-width='1.8' viewBox='0 0 24 24'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1.1rem center;
    padding-right: 2.8rem;
}
.field-input[aria-invalid="true"] {
    border-color: #B42318;
    box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.10);
}
.field-error { display: none; }
.field-input[aria-invalid="true"] ~ .field-error { display: block; }

/* Submit progress bar (> 2s latency indicator) */
.submit-progress { transform: scaleX(0); transform-origin: left; }
.is-submitting .submit-progress { animation: progress 6s cubic-bezier(.1,.7,.3,1) forwards; }
@keyframes progress { 0% { transform: scaleX(0); } 100% { transform: scaleX(.92); } }
.is-submitting .btn-label { opacity: .0; }
.is-submitting .btn-spinner { opacity: 1; }

/* ---------- FAQ accordion ---------- */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details .faq-icon { transition: transform .5s var(--ease-out-expo); }
details[open] .faq-icon { transform: rotate(45deg); }
details[open] .faq-body { animation: faqIn .6s var(--ease-out-expo); }
@keyframes faqIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile action bar ---------- */
.action-bar { transform: translateY(140%); transition: transform .6s var(--ease-out-expo); }
.action-bar.is-visible { transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .js [data-reveal] { opacity: 1; transform: none; }
}
