/**
 * HitchHiker Studio Attribution - Frontend Styles
 *
 * @package HitchHiker_Studio_Attribution
 */

/* ==========================================================================
   CSS Custom Properties (set via inline styles from plugin options)
   ========================================================================== */

:root {
    --hhsa-primary: #1a1a2e;
    --hhsa-secondary: #e94560;
    --hhsa-text: #6b7280;
    --hhsa-hover: #e94560;
    --hhsa-logo-width: 120px;
}

/* ==========================================================================
   Attribution Badge Container
   ========================================================================== */

.hhsa-attribution {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Centered variant */
.hhsa-attribution.hhsa-centered {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* ==========================================================================
   Text Element
   ========================================================================== */

.hhsa-text {
    color: var(--hhsa-primary);
    font-weight: 400;
    white-space: nowrap;
}

/* ==========================================================================
   Link Element
   ========================================================================== */

.hhsa-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease, transform 0.2s ease;
    outline: none;
}

.hhsa-link:hover,
.hhsa-link:focus {
    opacity: 0.85;
    transform: translateY(-1px);
}

.hhsa-link:focus-visible {
    outline: 2px solid var(--hhsa-secondary);
    outline-offset: 2px;
    border-radius: 4px;
}

.hhsa-link:active {
    transform: translateY(0);
}

/* ==========================================================================
   Logo Element
   ========================================================================== */

.hhsa-logo {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.hhsa-logo svg {
    width: var(--hhsa-logo-width);
    height: auto;
    display: block;
    max-width: 100%;
}

/* Logo color classes - for custom SVGs using these class names */
.hhsa-logo .hhsa-logo-primary {
    fill: var(--hhsa-primary);
    transition: fill 0.2s ease;
}

.hhsa-logo .hhsa-logo-secondary {
    fill: var(--hhsa-secondary);
    transition: fill 0.2s ease;
}

/* Default HitchHiker logo classes */
.hhsa-logo .logo-text {
    fill: var(--hhsa-primary) !important;
    transition: fill 0.2s ease;
}

.hhsa-logo .logo-shape {
    fill: var(--hhsa-secondary) !important;
    transition: fill 0.2s ease;
}

/* Hover effect on logo */
.hhsa-link:hover .hhsa-logo-primary,
.hhsa-link:focus .hhsa-logo-primary {
    fill: var(--hhsa-hover);
}

.hhsa-link:hover .logo-text,
.hhsa-link:focus .logo-text {
    fill: var(--hhsa-hover) !important;
}

/* ==========================================================================
   Keyword Text Element (when logo is hidden)
   ========================================================================== */

.hhsa-keyword {
    color: var(--hhsa-primary);
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.hhsa-link:hover .hhsa-keyword,
.hhsa-link:focus .hhsa-keyword {
    color: var(--hhsa-hover);
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Hide schema metadata visually but keep for SEO */
.hhsa-attribution meta,
.hhsa-attribution [itemprop="address"] {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .hhsa-link,
    .hhsa-logo .hhsa-logo-primary,
    .hhsa-logo .hhsa-logo-secondary,
    .hhsa-logo .logo-text,
    .hhsa-logo .logo-shape,
    .hhsa-keyword {
        transition: none;
    }
    
    .hhsa-link:hover,
    .hhsa-link:focus {
        transform: none;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    /* Only apply if CSS variables are not explicitly set */
    :root:not([data-hhsa-colors-set]) {
        --hhsa-text: #9ca3af;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .hhsa-attribution {
        color: #000 !important;
    }
    
    .hhsa-logo svg {
        /* Ensure logo prints in grayscale */
        filter: grayscale(1);
    }
    
    .hhsa-link::after {
        content: " (" attr(href) ")";
        font-size: 0.75em;
        color: #666;
    }
}

/* ==========================================================================
   Size Variants (via custom class)
   ========================================================================== */

/* Small variant */
.hhsa-attribution.hhsa-small {
    font-size: 0.75rem;
    gap: 0.375em;
}

.hhsa-attribution.hhsa-small .hhsa-logo svg {
    width: calc(var(--hhsa-logo-width) * 0.75);
}

/* Large variant */
.hhsa-attribution.hhsa-large {
    font-size: 1rem;
    gap: 0.625em;
}

.hhsa-attribution.hhsa-large .hhsa-logo svg {
    width: calc(var(--hhsa-logo-width) * 1.25);
}

/* ==========================================================================
   Layout Variants
   ========================================================================== */

/* Stacked/vertical layout */
.hhsa-attribution.hhsa-stacked {
    flex-direction: column;
    gap: 0.375em;
    text-align: center;
}

/* Block display (full width) */
.hhsa-attribution.hhsa-block {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 1em 0;
}

/* ==========================================================================
   Theme Variants (add via class attribute)
   ========================================================================== */

/* Light background optimized */
.hhsa-attribution.hhsa-light {
    --hhsa-text: #6b7280;
    --hhsa-primary: #1a1a2e;
}

/* Dark background optimized */
.hhsa-attribution.hhsa-dark {
    --hhsa-text: #d1d5db;
    --hhsa-primary: #f3f4f6;
}

/* Monochrome variant */
.hhsa-attribution.hhsa-mono {
    --hhsa-secondary: var(--hhsa-primary);
}

/* ==========================================================================
   Common Footer Integration
   ========================================================================== */

/* When placed directly in common footer containers */
footer .hhsa-attribution,
.site-footer .hhsa-attribution,
.footer-widgets .hhsa-attribution,
#footer .hhsa-attribution,
#colophon .hhsa-attribution {
    margin-top: 0.5em;
}

/* Popular theme compatibility */
.wp-block-group .hhsa-attribution {
    margin-block: 0.5em;
}
