/* ==========================================================================
   FM Meta Field Renderer — Frontend Styles
   Scoped to .fmmf-field to avoid theme conflicts.
   Follows Fool's Mate Design System (Inter, Gold Accent, Dark Support).
   ========================================================================== */

:root {
    --fmmf-text-color: inherit;
    --fmmf-accent: #d4af37;
    --fmmf-link-hover: #f1c95b;
    --fmmf-bg: transparent;
    --fmmf-font: 'Inter', system-ui, -apple-system, sans-serif;
    --fmmf-radius: 6px;
}

/* ==========================================================================
   Repeater Layouts (v0.2.0)
   ========================================================================== */

.fmmf-repeater {
    margin: 0 0 1.5rem 0;
    padding: 0;
    list-style: none;
}

/* List Layout */
ul.fmmf-repeater--list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

ul.fmmf-repeater--list li {
    padding-left: 1.5rem;
    position: relative;
}

ul.fmmf-repeater--list li::before {
    content: "•";
    color: var(--fmmf-accent);
    position: absolute;
    left: 0;
    top: 0;
    font-weight: bold;
}

/* Base field output */
.fmmf-field {
    font-family: var(--fmmf-font);
    color: var(--fmmf-text-color);
    line-height: 1.6;
}

/* Date format */
.fmmf-field--date {
    font-variant-numeric: tabular-nums;
}

/* Number format */
.fmmf-field--number {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* URL format */
.fmmf-field--url a {
    color: var(--fmmf-accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.fmmf-field--url a:hover,
.fmmf-field--url a:focus {
    color: var(--fmmf-link-hover);
    border-bottom-color: var(--fmmf-link-hover);
}

/* Image format */
.fmmf-field--image {
    display: inline-block;
}

.fmmf-field-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--fmmf-radius);
    display: block;
}

/* Elementor Editor Placeholder */
.fmmf-elementor-placeholder {
    font-family: var(--fmmf-font);
}

.fmmf-elementor-placeholder code {
    background: rgba(212, 175, 55, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* Grid Layout */
.fmmf-repeater--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.fmmf-grid-item {
    background: var(--fmmf-bg);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--fmmf-radius);
    padding: 1.25rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.fmmf-grid-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: var(--fmmf-link-hover);
}

/* Table Layout */
table.fmmf-repeater--table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    font-family: var(--fmmf-font);
}

table.fmmf-repeater--table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

table.fmmf-repeater--table tr:last-child td {
    border-bottom: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --fmmf-text-color: #e5e7eb;
    }
}

/* ==========================================================================
   v1.8.0: Responsive Grid Columns via --fmmf-cols
   ========================================================================== */

.fmmf-repeater--grid[style*="--fmmf-cols"] {
    grid-template-columns: repeat(var(--fmmf-cols), 1fr);
}

/* ==========================================================================
   v1.8.0: Masonry Layout
   ========================================================================== */

.fmmf-repeater--masonry {
    column-count: 3;
    column-gap: 1.5rem;
}

.fmmf-repeater--masonry[style*="--fmmf-cols"] {
    column-count: var(--fmmf-cols);
}

.fmmf-masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    background: var(--fmmf-bg);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--fmmf-radius);
    padding: 1.25rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.fmmf-masonry-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: var(--fmmf-link-hover);
}

/* ==========================================================================
   v1.8.0: Slider Layout
   ========================================================================== */

.fmmf-repeater--slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1.5rem;
    padding-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
}

.fmmf-repeater--slider::-webkit-scrollbar {
    height: 6px;
}

.fmmf-repeater--slider::-webkit-scrollbar-thumb {
    background: var(--fmmf-accent);
    border-radius: 3px;
}

.fmmf-slide {
    flex: 0 0 calc(100% / 3);
    scroll-snap-align: start;
    background: var(--fmmf-bg);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--fmmf-radius);
    padding: 1.25rem;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease;
}

.fmmf-repeater--slider[style*="--fmmf-cols"] .fmmf-slide {
    flex: 0 0 calc(100% / var(--fmmf-cols));
}

.fmmf-slide:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Responsive Fallbacks
   ========================================================================== */

@media (max-width: 768px) {
    .fmmf-repeater--grid[style*="--fmmf-cols"] {
        grid-template-columns: 1fr;
    }

    .fmmf-repeater--masonry,
    .fmmf-repeater--masonry[style*="--fmmf-cols"] {
        column-count: 1;
    }

    .fmmf-slide,
    .fmmf-repeater--slider[style*="--fmmf-cols"] .fmmf-slide {
        flex: 0 0 85%;
    }
}