/* Main CSS for Lily Memorial Site */

/* CSS Custom Properties (Variables) */
:root {
    /* Colors - Sunset Palette */
    --sunset-start: #FFB347;
    --sunset-end: #FF7043;
    --accent-orange: #FF8C00;
    --jade-green: #00A86B;
    --white: #FFF;
    --black: #1A1A1A;
    --gray-light: #F5F5F5;
    --gray-medium: #666;
    
    /* Typography */
    --font-heading: 'Cormorant', serif;
    --font-body: -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, sans-serif;

    /* Font Sizes */
    --font-size-base: 16px;
    --font-size-small: 0.875rem;  /* 14px */
    --font-size-medium: 1rem;     /* 16px */
    --font-size-large: 1.125rem;  /* 18px */
    --font-size-xlarge: 1.25rem;  /* 20px */
    --font-size-h3: 1.5rem;       /* 24px */
    --font-size-h2: 2rem;         /* 32px */
    --font-size-h1: 2.5rem;       /* 40px */
    --font-size-poem: 1.25rem;    /* 20px - larger for readability */

    /* Line Heights */
    --line-height-base: 1.6;
    --line-height-heading: 1.2;
    --line-height-poem: 1.5;      /* 1.5x spacing for poems */

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
    --spacing-xl: 4rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    color: var(--black);
    background: transparent;
    min-height: 100vh;
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: var(--line-height-heading);
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: var(--font-size-h1);
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
    font-size: var(--font-size-h2);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
    font-size: var(--font-size-h3);
    font-size: clamp(1.25rem, 3vw, 2rem);
}

p {
    margin-bottom: var(--spacing-sm);
}

/* Links */
a {
    color: var(--jade-green);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-orange);
    text-decoration: underline;
}

/* ----- ACCESSIBILITY FEATURES ----- */

/* Focus States (Accessibility) */
:focus {
    outline: none;
}

:focus-visible {
    outline: 3px solid #00A86B !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(0, 168, 107, 0.2);
    border-radius: 4px;
}

a:focus-visible {
    outline-offset: 4px;
}

button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible {
    outline-offset: 2px;
    transform: translateY(-1px);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline-offset: 0;
    border-color: #00A86B !important;
}

:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Touch Targets (Mobile Accessibility) */
button,
.btn,
[role="button"],
input[type="submit"],
input[type="button"],
.carousel-btn,
.nav-link,
.close-btn,
.interactive-element {
    min-width: 44px;
    min-height: 44px;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid currentcolor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Button Loading States */
.btn.is-loading,
button.is-loading {
    opacity: 0.8;
    cursor: wait;
    pointer-events: none;
}

.btn.is-success,
button.is-success {
    background: #00A86B !important;
    border-color: #00A86B !important;
}

/* Form Error Message */
.form-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: 16px;
    background: #FEE2E2;
    border: 1px solid #FECACA;
    border-radius: 8px;
    color: #DC2626;
    font-size: 0.875rem;
    animation: slide-in-error 0.3s ease;
}

@keyframes slide-in-error {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-error .error-icon {
    font-size: 1.25em;
    flex-shrink: 0;
}

/* ----- END ACCESSIBILITY FEATURES ----- */

/* Buttons */
button {
    font-family: var(--font-body);
    font-size: 1rem;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: 50px;
    background: var(--jade-green);
    color: var(--white);
    cursor: pointer;
    transition: all var(--transition-medium);
    font-weight: 500;
}

button:hover {
    background: var(--accent-orange);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Forms */
input[type="text"],
input[type="email"] {
    width: 100%;
    padding: var(--spacing-sm);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    transition: all var(--transition-fast);
    margin-bottom: var(--spacing-sm);
}

input[type="text"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: var(--jade-green);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.1);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.visually-hidden {
    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;
}

/* Global page container for max-width control on desktop */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Legacy container class for backwards compatibility */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Animations */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }

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

@keyframes sway {
    0%, 100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Mobile - Reduce spacing and font sizes */
@media (width <= 768px) {
    :root {
        --spacing-md: 1.5rem;
        --spacing-lg: 2rem;
        --spacing-xl: 3rem;
    }

    body {
        font-size: 14px;
    }
}

/* Tablet - 601px to 1024px */
@media (width >= 601px) and (width <= 1024px) {
    /* Stanza Room Grid - 3 columns on tablet (optimal use of space) */
    .stations-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem;
    }

    /* Slightly larger station cards on tablet */
    .station-card {
        min-height: 200px;
        padding: 1.5rem;
    }

    .station-letter {
        font-size: 3.5rem;
    }

    .station-title {
        font-size: 1.125rem;
    }
}

/* Desktop - Enhanced typography and spacing */
@media (width >= 1024px) {
    /* Page container with better padding on desktop */
    .page-container {
        padding: 0 2rem;
    }

    /* Enhanced typography for desktop readability */
    body {
        font-size: 18px;
    }

    /* Larger headings on desktop (10-20% increase) */
    h1 {
        font-size: clamp(2.5rem, 5vw, 3.5rem);
    }

    h2 {
        font-size: clamp(2rem, 4vw, 2.75rem);
    }

    h3 {
        font-size: clamp(1.5rem, 3vw, 2.25rem);
    }

    /* Improved poem text readability */
    .poem-content-wrapper {
        font-size: 1.375rem;
        line-height: 1.8;
    }

    /* Stanza Room Grid - Optimize card size on desktop */
    .stations-grid {
        gap: 1.5rem;
    }

    .station-card {
        min-width: 220px;
        padding: 2rem;
        transition: transform var(--transition-medium),
                    box-shadow var(--transition-medium);
    }

    /* Card hover states for desktop interactivity */
    .station-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        cursor: pointer;
    }

    .station-card:active {
        transform: translateY(-2px);
    }

    /* Larger station letters and titles on desktop */
    .station-letter {
        font-size: 4rem;
        transition: color var(--transition-medium);
    }

    .station-card:hover .station-letter {
        color: var(--accent-orange);
    }

    .station-title {
        font-size: 1.25rem;
    }
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1em;
    background: var(--white);
    color: var(--black);
    text-decoration: none;
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 0;
}

/* Loading State */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}

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

/* Poem Content Styles - Remove unwanted bullets from Google Docs conversion */
.poem-content-wrapper ul,
.poem-content-wrapper ol {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

.poem-content-wrapper li {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

/* Remove bullets globally from poem content */
.poem-content-wrapper ul li::before,
.poem-content-wrapper ol li::before {
    content: none;
    display: none;
}

/* Ensure poem formatting is preserved */
.poem-content-wrapper p {
    margin-bottom: 1em;
    line-height: var(--line-height-poem);
}

.poem-content-wrapper {
    white-space: normal;
    font-size: var(--font-size-poem);
    line-height: var(--line-height-poem);
}

/* Poem paragraphs - no extra margin for tighter line spacing
   Use higher specificity to override .poem-content-wrapper p */
.poem-content-wrapper .poem-paragraph {
    margin: 0;
    padding: 0;
}

/* Poem blank lines between stanzas */
.poem-blank-line {
    height: 1em;
    line-height: 1em;
}

/* Poem embedded images */
.poem-image {
    margin: 1.5rem auto;
    text-align: center;
    max-width: 100%;
}

.poem-image img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    object-fit: contain;
}

.poem-image figcaption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.poem-inline-image {
    max-width: 100%;
    max-height: 200px;
    vertical-align: middle;
    border-radius: 8px;
    margin: 0.25rem;
}

/* Skip Link (Accessibility) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff !important;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #00a86b;
    outline-offset: 2px;
}

/* Button Contrast Fix (WCAG) */
.enter-button,
.submit-btn,
.cta-button,
.primary-btn {
    background: linear-gradient(135deg, #ffb347, #ff9b3d) !important;
    color: #1a1a1a !important;
    font-weight: 600;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.enter-button:hover,
.submit-btn:hover,
.cta-button:hover,
.primary-btn:hover {
    background: linear-gradient(135deg, #ffc266, #ffb347) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 140, 0, 0.3);
}