/* ==========================================================================
   BLOSSOM - Base Styles
   Reset, typography, and utility classes
   ========================================================================== */

/* Fonts are loaded via <link rel="stylesheet"> in index.html, not @import.
   An @import inside a stylesheet is only discovered after that sheet has
   downloaded and parsed, which adds a serial round trip before first paint. */

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-light);
    background-color: var(--color-bg-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading fade-in effect */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([src=""]) {
    opacity: 1;
}

a {
    color: var(--color-gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-gold-light);
}

ul,
ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--color-cream);
}

h1 {
    font-size: var(--text-5xl);
}

h2 {
    font-size: var(--text-4xl);
}

h3 {
    font-size: var(--text-3xl);
}

h4 {
    font-size: var(--text-2xl);
}

h5 {
    font-size: var(--text-xl);
}

h6 {
    font-size: var(--text-lg);
}

p {
    margin-bottom: var(--space-4);
}

.text-gold {
    color: var(--color-gold);
}

.text-orange {
    /* --color-orange (#b35c1e) is only 3.88:1 on the dark background, which
       fails WCAG AA for body text. The lighter shade is 5.50:1. */
    color: var(--color-orange-light);
}

.text-muted {
    color: var(--color-text-muted);
}

/* ==========================================================================
   Layout Utilities
   ========================================================================== */

.container {
    width: 100%;
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-8);
    }
}

.section {
    padding: var(--space-16) 0;
}

@media (min-width: 768px) {
    .section {
        padding: var(--space-24) 0;
    }
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-12);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-gold), var(--color-orange));
    margin: var(--space-4) auto 0;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.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;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

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

.mb-6 {
    margin-bottom: var(--space-6);
}

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

.mt-8 {
    margin-top: var(--space-8);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    40% {
        transform: translateX(-50%) translateY(-10px);
    }

    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==========================================================================
   Skeleton Loaders & Loading States
   ========================================================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-darker) 25%,
        var(--color-brown) 50%,
        var(--color-bg-darker) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-card {
    background: var(--color-bg-darker);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--color-brown);
}

.skeleton-date {
    width: 60px;
    height: 70px;
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
}

.skeleton-title {
    width: 80%;
    height: 24px;
    margin-bottom: var(--space-3);
}

.skeleton-text {
    width: 100%;
    height: 16px;
    margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-text-sm {
    width: 30%;
    height: 12px;
    margin-bottom: var(--space-3);
}

.skeleton-news {
    min-height: 180px;
}

.skeleton-gallery {
    aspect-ratio: 1;
    padding: 0;
    overflow: hidden;
}

.skeleton-gallery::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--color-bg-darker) 25%,
        var(--color-brown) 50%,
        var(--color-bg-darker) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    color: var(--color-text-muted);
    gap: var(--space-4);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-brown);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner-container p {
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

/* ==========================================================================
   Skip Link
   Lets keyboard and screen-reader users jump past the header navigation.
   Hidden until focused.
   ========================================================================== */

.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    padding: var(--space-3) var(--space-5);
    background-color: var(--color-gold);
    color: var(--color-text-dark);
    font-family: var(--font-body);
    font-weight: var(--font-semibold);
    text-decoration: none;
    border-bottom-right-radius: var(--radius-md, 4px);
    transform: translateY(-120%);
    transition: transform var(--transition-fast, 0.15s) ease;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 2px solid var(--color-text-dark);
    outline-offset: -4px;
}

/* ==========================================================================
   Reduced Motion
   Respect the OS-level "reduce motion" preference across the whole site:
   scroll reveals, skeleton shimmer, spinners and hover transforms.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Keep skeletons visible as a flat block rather than a frozen gradient. */
    .skeleton,
    .skeleton-text,
    .skeleton-card {
        animation: none !important;
        background: var(--color-brown);
    }
}
