/* ============================================================================
   Dreams Page — Memorigi-themed redesign (2026-05-04)
   All selectors scoped to #dreamsPage so this stylesheet cannot leak into
   other pages. Color tokens reuse the app-wide --bg-*/--text-*/etc. variables
   defined in styles.css; --primary-glow and the accent palette are local.

   Retroactively added to git on 2026-05-18. Lives only on Bluehost before
   this date (uploaded via the pre-git-deploy FTP era). Per Open Watchlist #6
   the canonical home for NEW dream-card style changes is styles.css with
   #dreamsPage scoping — this legacy file is left in place but is not the
   active edit surface.
   ========================================================================== */

#dreamsPage {
    --primary-glow: rgba(139, 92, 246, 0.45);
    --dream-yellow: #fbbf24;
    --dream-blue:   #3b82f6;
    --dream-green:  #10b981;
    --dream-red:    #ef4444;
    --dream-pink:   #ec4899;
    --dream-cyan:   #22d3ee;
    --dream-orange: #f97316;
    --dream-purple: #8b5cf6;
}

/* ─────────── Header ─────────── */
#dreamsPage .dreams-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
#dreamsPage .dreams-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-color) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
}
#dreamsPage .dreams-title .sparkle {
    font-size: 0.85em;
    filter: drop-shadow(0 0 8px var(--primary-glow));
    -webkit-text-fill-color: initial;
}
#dreamsPage .dreams-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.35rem;
    font-style: italic;
}
#dreamsPage .btn-new-dream {
    background: linear-gradient(135deg, var(--primary-color), #6d28d9);
    color: white;
    border: none;
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 18px rgba(139, 92, 246, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#dreamsPage .btn-new-dream:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(139, 92, 246, 0.55);
}

/* ─────────── Filter chips ─────────── */
#dreamsPage .filter-row {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    margin-bottom: 1.5rem;
    align-items: center;
}
#dreamsPage .filter-row .label {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.4rem;
}
#dreamsPage .chip {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
    font-family: inherit;
}
#dreamsPage .chip:hover { color: var(--text-primary); border-color: var(--primary-color); }
#dreamsPage .chip.active {
    background: linear-gradient(135deg, var(--primary-color), #6d28d9);
    color: white;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.35);
}

/* ─────────── Section heading ─────────── */
#dreamsPage .section-heading {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 0.7rem;
    display: flex; align-items: center; gap: 0.4rem;
}
#dreamsPage .section-heading::before {
    content: "";
    width: 4px; height: 14px;
    background: var(--primary-color);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--primary-glow);
}

/* ─────────── Dreams grid ─────────── */
#dreamsPage .dreams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 0.5rem;
}

#dreamsPage .dream-card {
    background: var(--bg-secondary);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    isolation: isolate;
    padding: 0;
}
#dreamsPage .dream-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--accent, var(--primary-color));
    border-color: transparent;
}

/* ─── Hero photo block ─── */
#dreamsPage .dream-hero {
    height: 180px;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-tertiary);
}
#dreamsPage .hero-photo-track {
    position: absolute;
    inset: 0;
    display: flex;
    transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
    /* Browser handles vertical pan (page scroll); horizontal pans go to JS swipe handler */
    touch-action: pan-y;
    /* Block native image-drag and accidental text selection during a swipe */
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}
/*
 * Each photo paints in two layers:
 *   ::before — blurred copy at `cover` size, fills any letterbox bars
 *   ::after  — sharp copy at `contain` size, never cropped
 * The URL is set inline as `style="--photo: url('...')"` so both pseudos can
 * reuse it. The transform: scale on ::before hides the soft edges that bleed
 * outward from the blur radius — `overflow: hidden` on the parent keeps them
 * from leaking into the next photo in the sliding track.
 */
#dreamsPage .hero-photo {
    flex: 0 0 100%;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-tertiary);
    cursor: pointer;
    -webkit-user-drag: none;
}
#dreamsPage .hero-photo::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--photo);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(28px) brightness(0.55) saturate(1.1);
    transform: scale(1.15);
    pointer-events: none;
}
#dreamsPage .hero-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--photo);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}
#dreamsPage .dream-hero::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(15, 15, 23, 0) 35%, rgba(15, 15, 23, 0.85) 100%);
    pointer-events: none;
    z-index: 1;
}

/* No-photo fallback */
#dreamsPage .dream-hero.no-photo {
    display: grid;
    place-items: center;
    color: white;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
#dreamsPage .dream-hero.no-photo .fallback-emoji {
    font-size: 3.4rem;
    z-index: 2;
    position: relative;
}
#dreamsPage .dream-hero.no-photo {
    background: linear-gradient(135deg, var(--accent, var(--primary-color)), color-mix(in srgb, var(--accent, var(--primary-color)) 30%, #1a1a2e));
}

/* ─── Year ribbon ─── */
#dreamsPage .year-ribbon {
    position: absolute;
    left: 14px; bottom: 12px;
    z-index: 3;
    background: rgba(15, 15, 23, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: inline-flex; align-items: center; gap: 0.4rem;
}
#dreamsPage .year-ribbon .due-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* ─── Photo count badge ─── */
#dreamsPage .photo-count {
    position: absolute;
    top: 0.65rem; left: 0.65rem;
    background: rgba(15, 15, 23, 0.78);
    color: white;
    font-size: 0.74rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 3;
    display: inline-flex; align-items: center; gap: 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-weight: 600;
}

/* ─── Gallery navigation ─── */
#dreamsPage .gallery-dots {
    position: absolute;
    right: 14px; bottom: 14px;
    z-index: 3;
    display: flex; gap: 0.35rem;
}
#dreamsPage .gallery-dots .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    border: none;
    padding: 0;
}
#dreamsPage .gallery-dots .dot.active {
    background: white;
    width: 18px;
    border-radius: 999px;
}
#dreamsPage .gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(15, 15, 23, 0.78);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    z-index: 4;
    display: grid; place-items: center;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.16s ease, transform 0.16s ease, background 0.14s ease;
    font-family: inherit;
}
#dreamsPage .gallery-arrow.prev { left: 10px; }
#dreamsPage .gallery-arrow.next { right: 10px; }
#dreamsPage .dream-card:hover .gallery-arrow { opacity: 1; }
#dreamsPage .gallery-arrow:hover { background: var(--primary-color); transform: translateY(-50%) scale(1.08); }
#dreamsPage .dream-card:not(.has-multi) .gallery-arrow,
#dreamsPage .dream-card:not(.has-multi) .gallery-dots { display: none; }

/* ─── Accent strip ─── */
#dreamsPage .dream-accent-strip {
    height: 3px;
    background: var(--accent, var(--primary-color));
    box-shadow: 0 0 8px var(--accent, var(--primary-color));
}

/* ─── Body ─── */
#dreamsPage .dream-body {
    padding: 1rem 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1;
}
#dreamsPage .dream-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin: 0;
    color: var(--text-primary);
}
#dreamsPage .dream-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

/* ─── Hover quick actions ─── */
#dreamsPage .dream-card .quick-actions {
    position: absolute;
    top: 0.65rem; right: 0.65rem;
    display: flex; gap: 0.3rem;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.16s ease;
}
#dreamsPage .dream-card:hover .quick-actions,
#dreamsPage .dream-card:focus-within .quick-actions { opacity: 1; }
#dreamsPage .qa-btn {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: rgba(15, 15, 23, 0.88);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: grid; place-items: center;
    font-size: 0.85rem;
    transition: all 0.14s ease;
    padding: 0;
    font-family: inherit;
}
#dreamsPage .qa-btn:hover { transform: translateY(-1px); }
#dreamsPage .qa-btn.complete:hover { background: var(--dream-green); border-color: transparent; }
#dreamsPage .qa-btn.edit:hover     { background: var(--dream-blue);  border-color: transparent; }
#dreamsPage .qa-btn.lists:hover    { background: var(--primary-color); border-color: transparent; }
#dreamsPage .qa-btn.delete:hover   { background: var(--dream-red);   border-color: transparent; }

/* ─── Completed state ─── */
#dreamsPage .dream-card.completed { opacity: 0.92; }
#dreamsPage .dream-card.completed .dream-hero .hero-photo-track { filter: grayscale(0.35); }
#dreamsPage .dream-card.completed .dream-name { color: var(--text-secondary); }
#dreamsPage .dream-card.completed .dream-name::before {
    content: "✓";
    background: linear-gradient(135deg, var(--dream-green), #047857);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    margin-right: 0.4rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
    vertical-align: middle;
}
#dreamsPage .completion-ribbon {
    position: absolute;
    top: 14px; right: -36px;
    transform: rotate(35deg);
    background: linear-gradient(135deg, var(--dream-green), #047857);
    color: white;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 2.5rem;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4);
    z-index: 5;
    pointer-events: none;
}
#dreamsPage .celebration-strip {
    background: linear-gradient(90deg,
        rgba(251, 191, 36, 0.08) 0%,
        rgba(16, 185, 129, 0.14) 50%,
        rgba(236, 72, 153, 0.08) 100%);
    color: var(--dream-yellow);
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.45rem;
    border-top: 1px solid rgba(251, 191, 36, 0.22);
    letter-spacing: 0.04em;
}

/* ─── New-dream tile ─── */
#dreamsPage .dream-card.new-tile {
    border: 2px dashed var(--border-color);
    background: transparent;
    display: grid;
    place-items: center;
    min-height: 320px;
    color: var(--text-muted);
}
#dreamsPage .dream-card.new-tile:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 0 0 1px var(--primary-color), 0 8px 30px rgba(139, 92, 246, 0.18);
}
#dreamsPage .new-tile-inner { text-align: center; padding: 1rem; }
#dreamsPage .new-tile-plus { font-size: 2.4rem; margin-bottom: 0.4rem; line-height: 1; }

/* ─── Empty state (scoped, doesn't conflict with app-wide .empty-state) ─── */
#dreamsPage .dreams-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: clamp(2.5rem, 6vw, 4rem) 1rem;
    background:
        radial-gradient(ellipse 400px 240px at 50% 30%, rgba(139, 92, 246, 0.08), transparent 70%),
        var(--bg-secondary);
    border-radius: 22px;
    border: 1px dashed var(--border-color);
}
#dreamsPage .dreams-empty-icon {
    font-size: 3.5rem;
    margin-bottom: 0.85rem;
    filter: drop-shadow(0 0 14px var(--primary-glow));
}
#dreamsPage .dreams-empty-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}
#dreamsPage .dreams-empty-message {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 42ch;
    margin: 0 auto 1.25rem;
}

/* ─── Filter applied state — hides cards that don't match the active chip ─── */
#dreamsPage[data-year-filter="2026"] .dream-card[data-year]:not([data-year="2026"]),
#dreamsPage[data-year-filter="2027"] .dream-card[data-year]:not([data-year="2027"]),
#dreamsPage[data-year-filter="2028"] .dream-card[data-year]:not([data-year="2028"]),
#dreamsPage[data-year-filter="2029"] .dream-card[data-year]:not([data-year="2029"]),
#dreamsPage[data-year-filter="2030"] .dream-card[data-year]:not([data-year="2030"]) {
    display: none;
}
#dreamsPage[data-year-filter="achieved"] .dream-card:not(.completed),
#dreamsPage[data-year-filter="achieved"] .dream-card.new-tile { display: none; }
#dreamsPage[data-year-filter="achieved"] .dreams-section.in-progress { display: none; }
#dreamsPage[data-year-filter]:not([data-year-filter="all"]):not([data-year-filter="achieved"]) .dream-card.completed { display: none; }
#dreamsPage[data-year-filter]:not([data-year-filter="all"]):not([data-year-filter="achieved"]) .dreams-section.achieved { display: none; }

/* Hide whichever sections are entirely empty after a filter — done via the
   data-empty attribute set by JS, since :has() isn't safe everywhere yet */
#dreamsPage .dreams-section[data-empty="true"] { display: none; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    #dreamsPage .dreams-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
    #dreamsPage .dreams-header { align-items: flex-start; }
    #dreamsPage .gallery-arrow { width: 36px; height: 36px; opacity: 1; }
}
@media (max-width: 480px) {
    #dreamsPage .dream-hero { height: 160px; }
}
