/* SermonBridge Common Styles */

/* CSS Custom Properties */
:root {
    /* Candlelight Sanctuary palette - the single source of truth (see DESIGN.md).
       Defined here in the shared base so every page has the full token set. */
    --color-night: #0f0d0c;        /* Midnight - the room */
    --color-charcoal: #1a1714;     /* primary raised surface */
    --color-charcoal-light: #2d2a26; /* Ash - next layer up */
    --color-warm-gray: #2d2926;    /* alias of Ash */
    --color-stone: #4a4543;        /* borders, dividers, disabled text */
    --color-amber: #d4a853;        /* Candlelight Amber - the one flame */
    --color-amber-light: #e8c078;  /* Lamplight - hover/active */
    --color-amber-dark: #b8923f;   /* Burnished - pressed/subtle */
    --color-cream: #faf8f5;        /* Vellum Cream - primary text */
    --color-cream-dark: #f0ebe3;   /* Aged Vellum */
    --color-pearl: #f0ebe4;        /* Pearl - muted light */
    --color-rust: #c45d3e;         /* Ember Rust - secondary/warning */
    --color-sage: #7a8b6e;         /* Vestry Sage - tertiary */
    --color-success: #4a9d6e;      /* Sanctuary Green */
    --color-error: #dc4a4a;        /* Signal Red */
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Universal Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Base Body Styles */
body {
    font-family: var(--font-body);
    background: var(--color-night);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    font-weight: 400;
    letter-spacing: -0.01em;
}

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

/* Common Button Base */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    font-family: var(--font-body);
}

.btn-primary {
    background: var(--color-amber);
    color: var(--color-charcoal);
}

.btn-primary:hover {
    background: var(--color-amber-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(212, 168, 83, 0.3);
}

.btn-secondary {
    background: var(--color-charcoal-light);
    color: white;
}

.btn-secondary:hover {
    background: #3d3935;
}

/* Common Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 13, 12, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: var(--color-charcoal);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(212, 168, 83, 0.15);
}

.modal-header {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #ffffff;
    font-family: var(--font-display);
}

/* Common Error Styles */
.error {
    background: rgba(196, 93, 62, 0.2);
    color: #f5d4c8;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid rgba(196, 93, 62, 0.3);
}

/* Common Form Styles */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
    font-family: var(--font-body);
}

/* Common Screen Background */
.screen-gradient {
    background: linear-gradient(145deg, var(--color-charcoal) 0%, var(--color-night) 100%);
    position: relative;
}

.screen-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(212, 168, 83, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* Spinner Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-amber);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

/* Keyboard focus: a single visible amber ring on every interactive element.
   Mouse clicks keep their own styling; this only shows for keyboard users
   (:focus-visible). Required for WCAG 2.2 AA across all pages. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible {
    outline: 2px solid var(--color-amber);
    outline-offset: 2px;
}

/* The candlelit focus ring should glow softly rather than sit as a hard line. */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline-offset: 1px;
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.22);
}

/* Reduced motion: collapse every animation and transition to an instant state.
   Honors prefers-reduced-motion for the calm worship context (DESIGN.md). */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
