/* ----------------------------------------------------
   Fibers & Faith - Custom Front-End & Editor Styles
   ---------------------------------------------------- */

/* Reset & Base Elements */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
    scroll-behavior: smooth;
    min-height: 100vh;
}

/* Accessibility: Keyboard Navigation Focus Ring */
:focus-visible,
.wp-block-navigation a:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--wp--preset--color--primary) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 5px rgba(61, 83, 185, 0.2) !important;
}

/* Skip to Content Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--surface);
    padding: 12px 24px;
    border-radius: 9999px;
    z-index: 99999;
    font-weight: bold;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 20px;
}

/* Reading Progress Bar */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background-color: var(--wp--preset--color--primary);
    width: 0%;
    z-index: 100000;
    transition: width 0.1s ease-out;
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background-color: var(--wp--preset--color--surface);
    color: var(--wp--preset--color--primary);
    border: 1px solid var(--wp--preset--color--outline-variant);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}
#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
#back-to-top:hover {
    transform: scale(1.05);
    background-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--surface);
    border-color: var(--wp--preset--color--primary);
}

/* Dark Mode Overrides */
html.dark,
body.dark {
    /* Color Swaps */
    --wp--preset--color--background: #121214 !important;
    --wp--preset--color--on-surface: #fcf9f8 !important;
    --wp--preset--color--on-surface-variant: #c5c5d5 !important;
    --wp--preset--color--surface: #1b1b1f !important;
    --wp--preset--color--surface-container-low: #202024 !important;
    --wp--preset--color--surface-container: #28282c !important;
    --wp--preset--color--surface-container-high: #303035 !important;
    --wp--preset--color--surface-container-highest: #3a3a40 !important;
    --wp--preset--color--outline: #8e8f9c !important;
    --wp--preset--color--outline-variant: #444653 !important;
    
    /* Adjusted Primary for High Dark-Contrast */
    --wp--preset--color--primary: #b9c3ff !important;
    
    background-color: #121214 !important;
    color: #fcf9f8 !important;
}

html.dark body {
    background-color: #121214 !important;
    color: #fcf9f8 !important;
}

/* Dark Mode Navigation links */
html.dark .wp-block-navigation a,
html.dark .wp-block-navigation-item__content {
    color: #fcf9f8 !important;
}
html.dark .wp-block-navigation a:hover {
    color: #b9c3ff !important;
}

/* Card Hover Animations & Tonal Elevations */
.group-card {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.group-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.04);
    border-color: var(--wp--preset--color--primary) !important;
}

/* Timeline Components styling */
.timeline-container {
    position: relative;
    padding-left: 32px;
    border-left: 2px solid var(--wp--preset--color--outline-variant);
}
.timeline-dot {
    position: absolute;
    left: -7px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--wp--preset--color--primary);
    border: 2px solid var(--wp--preset--color--background);
    transition: background-color 0.3s ease;
}
.timeline-item:hover .timeline-dot {
    background-color: var(--wp--preset--color--secondary);
}

/* Utility Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0s !important;
        scroll-behavior: auto !important;
    }
}
