/* ═══════════════════════════════════════════════════════════
   LUMINA PUBLISH — PUBLIC CSS
   Breakpoints: 320px | 375px | 414px | 768px | 1024px+
   ═══════════════════════════════════════════════════════════ */

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    max-width: 100vw;
    background: var(--lp-bg, #ffffff);
    color: var(--lp-text, #1a1a1a);
    font-family: var(--lp-body-font, 'Outfit', sans-serif);
    font-size: var(--lp-body-size, 15px);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
    display: block;
}

a { color: var(--lp-gold, #C9A84C); }
p { margin: 0 0 1em; }

/* ── CSS VARIABLES ────────────────────────────────────────── */
:root {
    --lp-bg: #ffffff;
    --lp-surface: #fafaf8;
    --lp-text: #1a1a1a;
    --lp-muted: #777777;
    --lp-gold: #C9A84C;
    --lp-burgundy: #800020;
    --lp-nav-bg: #ffffff;
    --lp-border: #e8e4dc;
    /* Spacing scale */
    --sp-xs: 8px;
    --sp-sm: 12px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 40px;
}

/* ── NAVBAR ───────────────────────────────────────────────── */
.lp-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px var(--sp-lg);
    border-bottom: 1px solid var(--lp-border);
    background: var(--lp-nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
}

.lp-nav-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--lp-gold);
    text-decoration: none;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.lp-nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-shrink: 0;
}

.lp-nav-link {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lp-muted);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}
.lp-nav-link:hover { color: var(--lp-burgundy); }

.lp-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Search box */
.lp-search-wrap { position: relative; }
.lp-search-input {
    padding: 6px 12px;
    border: 1px solid var(--lp-border);
    border-radius: 20px;
    font-size: 12px;
    background: var(--lp-surface);
    color: var(--lp-text);
    width: 140px;
    font-family: inherit;
    outline: none;
    transition: width 0.3s, border-color 0.2s;
}
.lp-search-input:focus { border-color: var(--lp-gold); width: 200px; }

.lp-search-results {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 300px;
    background: var(--lp-bg);
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    z-index: 200;
    max-height: 360px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    display: none;
}
.lp-search-result {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--lp-border);
    text-decoration: none;
    transition: background 0.15s;
}
.lp-search-result:hover { background: var(--lp-surface); }
.lp-search-result-title { font-size: 13px; font-weight: 600; color: var(--lp-text); margin-bottom: 3px; }
.lp-search-result-cat { font-size: 11px; color: var(--lp-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.lp-search-empty { padding: 20px; text-align: center; color: var(--lp-muted); font-size: 13px; }

/* Mobile drawer */
.lp-nav-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
}
.lp-nav-drawer.open { display: block; }
.lp-nav-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}
.lp-nav-drawer-panel {
    position: absolute;
    top: 0; right: 0;
    width: 260px;
    max-width: 80vw;
    height: 100%;
    background: var(--lp-nav-bg);
    border-left: 1px solid var(--lp-border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
}
.lp-nav-drawer-close {
    align-self: flex-end;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--lp-muted);
    margin-bottom: 16px;
    padding: 0;
    line-height: 1;
}
.lp-nav-drawer-link {
    display: block;
    padding: 14px 0;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lp-text);
    text-decoration: none;
    border-bottom: 1px solid var(--lp-border);
}
.lp-nav-drawer-link:hover { color: var(--lp-gold); }

.lp-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 4px;
    flex-shrink: 0;
}
.lp-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--lp-text);
    border-radius: 2px;
}

/* ── CAROUSEL ─────────────────────────────────────────────── */
.lp-carousel-outer { position: relative; }
.lp-carousel-wrap { overflow: hidden; padding: 4px 0 8px; }
.lp-carousel-track {
    display: flex;
    gap: 16px;
    padding: 0 var(--sp-lg);
    transition: transform 0.42s cubic-bezier(0.25,0.46,0.45,0.94);
    will-change: transform;
    cursor: grab;
    user-select: none;
}
.lp-carousel-track.dragging { transition: none; cursor: grabbing; }
.lp-carousel-card {
    flex: 0 0 280px;
    background: var(--lp-surface);
    border-radius: 12px;
    overflow: hidden;
    border: 0.5px solid var(--lp-border);
    transition: transform 0.35s ease, opacity 0.35s ease, border-color 0.35s ease;
    opacity: 0.7;
    transform: scale(0.96);
}
.lp-carousel-card.active { opacity: 1; transform: scale(1); border-color: rgba(201,168,76,0.5); }
.lp-carousel-img { width: 100%; height: 160px; position: relative; overflow: hidden; background: var(--lp-surface); }
.lp-carousel-img > div { transition: transform 0.5s ease; width: 100%; height: 100%; }
.lp-carousel-card:hover .lp-carousel-img > div { transform: scale(1.04); }
.lp-card-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 3px;
    font-weight: 600;
}
.lp-carousel-btn {
    display: block;
    width: 100%;
    padding: 8px;
    border: 0.5px solid var(--lp-border);
    background: transparent;
    color: var(--lp-muted);
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}
.lp-carousel-card.active .lp-carousel-btn { border-color: rgba(201,168,76,0.4); color: var(--lp-gold); }
.lp-carousel-btn:hover { background: var(--lp-gold) !important; color: #1a1a1a !important; border-color: var(--lp-gold) !important; }
.lp-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-70%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: 0.5px solid var(--lp-border);
    color: var(--lp-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 10;
    font-size: 18px;
}
.lp-carousel-outer:hover .lp-carousel-nav { opacity: 1; }
.lp-carousel-nav:hover { background: var(--lp-gold); color: #1a1a1a; }
.lp-carousel-nav:disabled { opacity: 0.2 !important; pointer-events: none; }
.lp-carousel-prev { left: 8px; }
.lp-carousel-next { right: 8px; }
.lp-carousel-progress { height: 2px; background: rgba(201,168,76,0.15); margin: 10px var(--sp-lg) 0; border-radius: 1px; overflow: hidden; }
.lp-carousel-progress-fill { height: 100%; background: var(--lp-gold); border-radius: 1px; width: 0%; transition: width 0.1s linear; }
.lp-carousel-dots { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; height: 8px; }
.lp-carousel-dot { height: 4px; border-radius: 2px; background: rgba(201,168,76,0.25); transition: width 0.35s cubic-bezier(0.25,0.46,0.45,0.94), background 0.35s; width: 16px; cursor: pointer; border: none; padding: 0; }
.lp-carousel-dot.active { width: 28px; background: var(--lp-gold); }

/* ── POST GRID ────────────────────────────────────────────── */
.lp-post-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    border-top: 1px solid var(--lp-border);
    border-left: 1px solid var(--lp-border);
    width: 100%;
}
.lp-post-card-wrap {
    border-right: 1px solid var(--lp-border);
    border-bottom: 1px solid var(--lp-border);
    transition: background 0.2s;
}
.lp-post-card-wrap:hover { background: var(--lp-surface); }

/* ── SINGLE POST ──────────────────────────────────────────── */
#lp-reading-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: var(--lp-gold);
    z-index: 999;
    width: 0%;
    transition: width 0.1s linear;
}

/* Checklist */
.lp-checklist { background: var(--lp-surface); border: 1px solid var(--lp-border); border-radius: 8px; padding: 20px; margin: 28px 0; }
.lp-checkbox {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid var(--lp-border);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}
.lp-checkbox.checked {
    background: var(--lp-gold);
    border-color: var(--lp-gold);
}
.lp-checkbox.checked::after {
    content: '';
    display: block;
    width: 6px;
    height: 4px;
    border-left: 2px solid #1a1a1a;
    border-bottom: 2px solid #1a1a1a;
    transform: rotate(-45deg) translateY(-1px);
}
.lp-check-label.striked { text-decoration: line-through; color: var(--lp-muted); }

/* Assessment */
.lp-assessment-btn { transition: all 0.2s; }
.lp-assessment-btn:hover { background: rgba(201,168,76,0.1) !important; }
.lp-assessment-btn.selected { background: var(--lp-gold) !important; color: #1a1a1a !important; border-color: var(--lp-gold) !important; }

/* Reactions */
.lp-reaction-btn { transition: all 0.2s; }
.lp-reaction-btn:hover { border-color: var(--lp-burgundy) !important; color: var(--lp-burgundy) !important; }
.lp-reaction-btn.active { border-color: var(--lp-burgundy) !important; color: var(--lp-burgundy) !important; background: rgba(128,0,32,0.06) !important; }

/* Drop cap */
.lp-dropcap {
    float: left;
    font-size: 3.5em;
    line-height: 0.85;
    margin-right: 8px;
    color: var(--lp-gold);
    font-family: var(--lp-headline-font, 'Playfair Display', serif);
}

/* Result card */
.lp-result-card {
    background: var(--lp-bg);
    border: 1px solid var(--lp-gold);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    animation: lpSlideIn 0.3s ease;
}
@keyframes lpSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Toast */
.lp-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: var(--lp-gold);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 9999;
    animation: lpSlideIn 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}

/* Bookmark button */
.lp-bookmark-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1.5px solid var(--lp-gold, #C9A84C);
    border-radius: 20px;
    background: transparent;
    color: var(--lp-gold, #C9A84C);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.lp-bookmark-btn:hover,
.lp-bookmark-btn.saved {
    background: var(--lp-gold, #C9A84C);
    color: #1a1a1a;
}

/* Views badge */
.lp-views-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--lp-muted);
}

/* Scroll time */
#lp-scroll-time { font-size: 12px; color: var(--lp-muted); transition: color 0.3s; }
#lp-scroll-time.almost-done { color: var(--lp-gold); font-weight: 600; }

/* Related posts */
.lp-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid var(--lp-border);
    border-left: 1px solid var(--lp-border);
}
.lp-related-card {
    border-right: 1px solid var(--lp-border);
    border-bottom: 1px solid var(--lp-border);
    padding: 14px;
    text-decoration: none;
    display: block;
    transition: background 0.2s;
}
.lp-related-card:hover { background: var(--lp-surface); }

/* Email capture */
.lp-email-capture {
    background: var(--lp-surface);
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    padding: 24px var(--sp-lg);
    margin: 32px 0;
    text-align: center;
}
.lp-email-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--lp-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: var(--lp-bg);
    color: var(--lp-text);
    box-sizing: border-box;
    margin: 10px 0 8px;
}
.lp-email-input:focus { outline: none; border-color: var(--lp-gold); }
.lp-email-submit {
    width: 100%;
    padding: 10px;
    background: var(--lp-gold);
    color: #1a1a1a;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}
.lp-email-submit:hover { opacity: 0.85; }

/* Next post strip */
#lp-next-strip {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--lp-surface);
    border-top: 1px solid var(--lp-border);
    padding: 14px var(--sp-lg);
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25,0.46,0.45,0.94);
    z-index: 90;
}

/* Series box */
.lp-series-box {
    background: var(--lp-surface);
    border: 1px solid var(--lp-border);
    border-left: 3px solid var(--lp-gold);
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin: 28px 0;
}

/* Reading list page */
.lp-reading-list-empty { text-align: center; padding: 60px 24px; color: var(--lp-muted); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════ */

/* ── 768px and below (tablet + mobile) ───────────────────── */
@media (max-width: 768px) {
    .lp-nav { padding: 12px var(--sp-md); }
    .lp-nav-links { display: none !important; }
    .lp-search-wrap { display: none; }
    .lp-hamburger { display: flex; }

    .lp-post-grid { grid-template-columns: 1fr; }

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

    article {
        padding-left: var(--sp-md) !important;
        padding-right: var(--sp-md) !important;
    }

    #lp-next-strip { padding: 12px var(--sp-md); }
    #lp-next-strip .lp-next-label { display: none; }

    .lp-email-capture { padding: 20px var(--sp-md); }

    .lp-carousel-track { padding: 0 var(--sp-md); }
    .lp-carousel-nav { display: none; }
}

/* ── 414px and below (large phones: iPhone Plus, Redmi) ──── */
@media (max-width: 414px) {
    :root { --sp-md: 14px; }

    .lp-nav { padding: 10px 14px; gap: 6px; }
    .lp-nav-logo { font-size: 15px; }

    .lp-post-grid { grid-template-columns: 1fr; }
    .lp-related-grid { grid-template-columns: 1fr; }

    .lp-carousel-card { flex: 0 0 80vw; }

    article {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .lp-checklist { padding: 14px; }

    /* Reactions wrap on small screens */
    #lp-reactions-row {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .lp-reaction-btn {
        font-size: 11px !important;
        padding: 6px 10px !important;
    }

    .lp-bookmark-btn { font-size: 12px; padding: 6px 12px; }

    /* Score bar */
    #lp-score-bar { padding: 10px 14px !important; }

    /* Streak */
    #lp-streak { padding: 10px 14px !important; font-size: 12px !important; }

    /* Takeaway */
    #lp-takeaway-box { padding: 16px 14px !important; }
}

/* ── 375px and below (iPhone SE, standard) ───────────────── */
@media (max-width: 375px) {
    :root { --sp-md: 12px; }

    .lp-nav { padding: 10px 12px; }
    .lp-nav-logo { font-size: 14px; letter-spacing: 0.02em; }

    article {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .lp-carousel-card { flex: 0 0 85vw; }

    .lp-toast {
        font-size: 12px;
        padding: 8px 16px;
        max-width: calc(100vw - 24px);
        white-space: normal;
        text-align: center;
    }
}

/* ── 320px and below (very small phones) ─────────────────── */
@media (max-width: 320px) {
    :root { --sp-md: 10px; }

    .lp-nav { padding: 8px 10px; }
    .lp-nav-logo { font-size: 13px; }

    article {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .lp-checklist { padding: 10px; }
    .lp-bookmark-btn { padding: 5px 10px; font-size: 11px; }
    .lp-reaction-btn { font-size: 10px !important; padding: 5px 8px !important; }

    .lp-carousel-card { flex: 0 0 90vw; }
}
