/**
 * CMS THEME SYSTEM
 * ================
 * Universal styles for smart theme rendering
 * Works with cms/universal/theme.html
 * 
 * All classes prefixed with "theme-" to avoid conflicts
 */

/* ============================================
   CSS VARIABLES (Customizable per site)
   ============================================ */
:root {
    /* Colors */
    --theme-primary: var(--accent);
    --theme-primary-dark: #0052a3;
    --theme-primary-light: #3399ff;
    --theme-secondary: #6c757d;
    --theme-accent: #ff6b35;
    
    /* Backgrounds */
    --theme-bg: var(--bg);
    --theme-bg-alt: var(--surface);
    --theme-bg-dark: #0a0a1a;
    --theme-bg-hero: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 100%);
    
    /* Text */
    --theme-text: var(--fg-muted);
    --theme-text-light: var(--fg-muted);
    --theme-text-muted: var(--fg-subtle);
    --theme-text-inverse: var(--bg);
    
    /* Borders */
    --theme-border: var(--border);
    --theme-border-light: var(--surface-2);
    
    /* Shadows */
    --theme-shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --theme-shadow: 0 4px 12px rgba(0,0,0,0.1);
    --theme-shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    
    /* Spacing */
    --theme-gap-sm: 0.5rem;
    --theme-gap: 1rem;
    --theme-gap-lg: 2rem;
    --theme-gap-xl: 4rem;
    
    /* Border Radius */
    --theme-radius-sm: 4px;
    --theme-radius: 8px;
    --theme-radius-lg: 16px;
    --theme-radius-full: 9999px;
    
    /* Container */
    --theme-container-width: 1200px;
    --theme-content-width: 800px;
}

/* Dark mode overrides */
[data-theme="dark"], .dark-mode {
    --theme-bg: #0a0a1a;
    --theme-bg-alt: #1a1a2e;
    --theme-text: var(--bg);
    --theme-text-light: #b0b0b0;
    --theme-text-muted: #808080;
    --theme-border: var(--fg-muted);
}

/* ============================================
   HERO SECTION
   ============================================ */
.theme-hero {
    padding: 6rem 2rem;
    min-height: 70vh;
    display: flex;
    align-items: center;
    background: var(--theme-bg-hero);
    color: var(--theme-text-inverse);
    background-size: cover;
    background-position: center;
    position: relative;
}

.theme-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    pointer-events: none;
}

.theme-hero[style*="background-image"]::before {
    background: rgba(0,0,0,0.5);
}

.theme-hero__container {
    position: relative;
    z-index: 1;
    max-width: var(--theme-container-width);
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--theme-gap-xl);
    align-items: center;
}

.theme-hero__content {
    max-width: 600px;
}

.theme-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    margin: 0 0 1rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--theme-radius-full);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.92);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.theme-hero__title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--bg) 0%, #a0a0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-hero__subtitle {
    font-size: 1.25rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.theme-hero__description {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.theme-hero__actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.theme-hero__media {
    display: flex;
    justify-content: center;
    align-items: center;
}

.theme-hero__image {
    max-width: 100%;
    height: auto;
    border-radius: var(--theme-radius-lg);
    box-shadow: var(--theme-shadow-lg);
}

@media (max-width: 900px) {
    .theme-hero {
        min-height: auto;
        padding: 4rem 1.5rem;
    }
    
    .theme-hero__container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .theme-hero__content {
        max-width: 100%;
    }
    
    .theme-hero__actions {
        justify-content: center;
    }
    
    .theme-hero__media {
        order: -1;
        margin-bottom: 2rem;
    }
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.theme-main {
    padding: var(--theme-gap-xl) var(--theme-gap-lg);
    max-width: var(--theme-container-width);
    margin: 0 auto;
}

/* ============================================
   SECTIONS
   ============================================ */
.theme-section {
    margin-bottom: var(--theme-gap-xl);
}

.theme-section__title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--theme-gap-lg);
    text-align: center;
}

.theme-section--cards {
    padding: var(--theme-gap-xl) 0;
}

.theme-section--banner {
    background: var(--theme-bg-alt);
    padding: var(--theme-gap-xl) var(--theme-gap-lg);
    text-align: center;
}

/* ============================================
   GRID SYSTEM
   ============================================ */
.theme-grid {
    display: grid;
    gap: var(--theme-gap-lg);
}

.theme-grid--auto {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.theme-grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.theme-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.theme-grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .theme-grid--2,
    .theme-grid--3,
    .theme-grid--4 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   CARDS
   ============================================ */
.theme-card {
    background: var(--theme-bg);
    border-radius: var(--theme-radius-lg);
    padding: var(--theme-gap-lg);
    box-shadow: var(--theme-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.theme-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--theme-shadow-lg);
}

.theme-card__icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-primary-light) 100%);
    border-radius: var(--theme-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--bg);
}

.theme-card__icon svg {
    width: 24px;
    height: 24px;
}

.theme-card__image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--theme-radius);
    margin-bottom: 1rem;
}

.theme-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--theme-text);
}

.theme-card__subtitle {
    font-size: 0.9rem;
    color: var(--theme-primary);
    margin-bottom: 0.5rem;
}

.theme-card__text {
    color: var(--theme-text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.theme-card__link {
    color: var(--theme-primary);
    text-decoration: none;
    font-weight: 500;
    margin-top: auto;
}

.theme-card__link:hover {
    text-decoration: underline;
}

/* ============================================
   CONTENT / PROSE
   ============================================ */
.theme-content {
    max-width: var(--theme-content-width);
    margin: 0 auto var(--theme-gap-xl);
    line-height: 1.8;
    color: var(--theme-text);
}

.theme-content.prose h1,
.theme-content.prose h2,
.theme-content.prose h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.theme-content.prose p {
    margin-bottom: 1rem;
}

.theme-content.prose img {
    max-width: 100%;
    border-radius: var(--theme-radius);
    margin: 1.5rem 0;
}

.theme-content.prose ul,
.theme-content.prose ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.theme-content.prose blockquote {
    border-left: 4px solid var(--theme-primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--theme-text-light);
}

/* ============================================
   MEDIA
   ============================================ */
.theme-media {
    margin: var(--theme-gap-lg) 0;
}

.theme-media img,
.theme-media video {
    max-width: 100%;
    border-radius: var(--theme-radius);
}

.theme-media--hero img {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
}

.theme-media--banner img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

/* Gallery */
.theme-gallery {
    display: grid;
    gap: var(--theme-gap);
}

.theme-gallery--grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.theme-gallery--masonry {
    columns: 3;
    column-gap: var(--theme-gap);
}

.theme-gallery__item {
    margin: 0;
    overflow: hidden;
    border-radius: var(--theme-radius);
}

.theme-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.theme-gallery__item:hover img {
    transform: scale(1.05);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    border-radius: var(--theme-radius);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn--primary {
    background: var(--theme-primary);
    color: var(--bg);
}

.btn--primary:hover {
    background: var(--theme-primary-dark);
    transform: translateY(-2px);
}

.btn--secondary {
    background: transparent;
    color: currentColor;
    border: 2px solid currentColor;
}

.btn--secondary:hover {
    background: rgba(255,255,255,0.1);
}

.btn--accent {
    background: var(--theme-accent);
    color: var(--bg);
}

.btn--large {
    padding: 1.125rem 2.25rem;
    font-size: 1.1rem;
}

.btn--small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ============================================
   TAGS / BADGES
   ============================================ */
.theme-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--theme-gap-sm);
    margin: var(--theme-gap) 0;
}

.theme-tag {
    background: var(--theme-bg-alt);
    color: var(--theme-text-light);
    padding: 0.25rem 0.75rem;
    border-radius: var(--theme-radius-full);
    font-size: 0.875rem;
}

.theme-badge {
    display: inline-block;
    background: var(--theme-primary);
    color: var(--bg);
    padding: 0.25rem 0.75rem;
    border-radius: var(--theme-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* ============================================
   RATINGS
   ============================================ */
.theme-rating {
    display: inline-flex;
    gap: 0.125rem;
}

.theme-rating__star {
    color: var(--theme-border);
    font-size: 1.25rem;
}

.theme-rating__star--filled {
    color: #ffc107;
}

/* ============================================
   LINKS / CONTACT
   ============================================ */
.theme-link {
    color: var(--theme-primary);
    text-decoration: none;
}

.theme-link:hover {
    text-decoration: underline;
}

.theme-email,
.theme-phone {
    color: var(--theme-primary);
    text-decoration: none;
}

.theme-date {
    color: var(--theme-text-muted);
    font-size: 0.875rem;
}

/* ============================================
   COMPONENTS / DYNAMIC ZONES
   ============================================ */
.theme-component {
    margin: var(--theme-gap-lg) 0;
}

.theme-dynamic-zone {
    margin: var(--theme-gap-xl) 0;
}

/* ============================================
   FIELDS (GENERIC)
   ============================================ */
.theme-field {
    margin: var(--theme-gap) 0;
}

.theme-text {
    line-height: 1.7;
    color: var(--theme-text);
}

.theme-relation {
    display: flex;
    gap: var(--theme-gap);
    flex-wrap: wrap;
}

.theme-relation a {
    color: var(--theme-primary);
    text-decoration: none;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.theme-empty {
    text-align: center;
    padding: var(--theme-gap-xl);
    color: var(--theme-text-muted);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }

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