/* =====================================================
   HONESTLY, E — Reflections on the Timeline
   A reflection (Take 5, a week, a month, a year) sits on
   the spine as a BAR, not a dot: the events are the
   moments, the reflection is the span that holds them.
   Tinted with the companion who wrote it. Clicking a bar
   opens the reflection to read (and hear, once narrated).

   Loaded after timeline.css — bars live inside
   .timeline-markers on desktop (#timeline-markers) and in
   the mobile drawer (#timeline-drawer-markers).
   ===================================================== */

/* -----------------------------------------------------
   Companion accents
   One tint per companion (the bar's wash + left edge) and
   one deeper ink for the companion's name so the text is
   never faint on the tinted ground. Ellen's rose matches
   --ellen-color in life-arcs-panel.css. Ella carries the
   Pas Perdu blue; Ellis keeps the Honestly-E navy.
   ----------------------------------------------------- */
:root {
    --companion-ellen:  #B07B7B;  --companion-ellen-deep:  #874F4F;
    --companion-ellie:  #7A9A7E;  --companion-ellie-deep:  #4B6B4F;
    --companion-ellis:  #1B365D;  --companion-ellis-deep:  #142847;
    --companion-essie:  #D08770;  --companion-essie-deep:  #9E4F38;
    --companion-ezra:   #C29A4B;  --companion-ezra-deep:   #7F6122;
    --companion-emory:  #3C3C4E;  --companion-emory-deep:  #26262F;
    --companion-erik:   #6F7D8A;  --companion-erik-deep:   #45505A;
    --companion-eddie:  #B0563B;  --companion-eddie-deep:  #7E3B27;
    --companion-elias:  #7E6B9E;  --companion-elias-deep:  #544370;
    --companion-ella:   #2B4C7E;  --companion-ella-deep:   #1B365D;
    --companion-elif:   #4E8C8A;  --companion-elif-deep:   #2F6260;
    --companion-ember:  #C98A2E;  --companion-ember-deep:  #855A18;
}

/* Each bar picks its companion's pair into two local
   variables; everything below reads only those two. A
   companion we don't know falls back to the brand gold. */
.timeline-reflection-bar { --bar-accent: var(--gold); --bar-ink: var(--gold-dark); }
.timeline-reflection-bar.companion-ellen { --bar-accent: var(--companion-ellen); --bar-ink: var(--companion-ellen-deep); }
.timeline-reflection-bar.companion-ellie { --bar-accent: var(--companion-ellie); --bar-ink: var(--companion-ellie-deep); }
.timeline-reflection-bar.companion-ellis { --bar-accent: var(--companion-ellis); --bar-ink: var(--companion-ellis-deep); }
.timeline-reflection-bar.companion-essie { --bar-accent: var(--companion-essie); --bar-ink: var(--companion-essie-deep); }
.timeline-reflection-bar.companion-ezra  { --bar-accent: var(--companion-ezra);  --bar-ink: var(--companion-ezra-deep); }
.timeline-reflection-bar.companion-emory { --bar-accent: var(--companion-emory); --bar-ink: var(--companion-emory-deep); }
.timeline-reflection-bar.companion-erik  { --bar-accent: var(--companion-erik);  --bar-ink: var(--companion-erik-deep); }
.timeline-reflection-bar.companion-eddie { --bar-accent: var(--companion-eddie); --bar-ink: var(--companion-eddie-deep); }
.timeline-reflection-bar.companion-elias { --bar-accent: var(--companion-elias); --bar-ink: var(--companion-elias-deep); }
.timeline-reflection-bar.companion-ella  { --bar-accent: var(--companion-ella);  --bar-ink: var(--companion-ella-deep); }
.timeline-reflection-bar.companion-elif  { --bar-accent: var(--companion-elif);  --bar-ink: var(--companion-elif-deep); }
.timeline-reflection-bar.companion-ember { --bar-accent: var(--companion-ember); --bar-ink: var(--companion-ember-deep); }

/* -----------------------------------------------------
   The bar on the spine
   Pulled left so its solid edge sits over the spine
   (the spine is at 2rem in the scroll area; the markers
   column starts at 4rem), then runs the full width of
   the column. Tinted wash, solid companion edge, rounded.
   ----------------------------------------------------- */
.timeline-reflection-bar {
    position: relative;
    display: block;
    width: calc(100% + 2rem);
    margin: 0.6rem 0 0.6rem -2rem;
    padding: 0.65rem 0.9rem 0.65rem 1.1rem;
    border-radius: 10px;
    border-left: 4px solid var(--bar-accent);
    background: color-mix(in srgb, var(--bar-accent) 13%, var(--bg-card));
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    z-index: 1;
}

/* Browsers without color-mix still get a readable, tinted bar. */
@supports not (background: color-mix(in srgb, red 10%, white)) {
    .timeline-reflection-bar {
        background: var(--bg-secondary);
    }
}

.timeline-reflection-bar:hover {
    background: color-mix(in srgb, var(--bar-accent) 20%, var(--bg-card));
    box-shadow: var(--shadow-sm);
    transform: translateX(2px);
}

.timeline-reflection-bar:focus-visible {
    outline: 2px solid var(--bar-ink);
    outline-offset: 2px;
}

/* First line: the period ("Week of Sep 14 – 20", "September",
   "Your Take 5") with the play glyph on the right when the
   narration exists. */
.timeline-reflection-bar-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.timeline-reflection-bar-period {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-primary);
}

.timeline-reflection-bar-play {
    flex-shrink: 0;
    font-size: 0.7rem;
    line-height: 1;
    color: var(--bar-ink);
    font-weight: 600;
}

/* Second line: who wrote it. Deep ink, 600 weight — legible
   on the wash, never faint. */
.timeline-reflection-bar-companion {
    margin-top: 0.15rem;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--bar-ink);
}

/* A reflection written in the memories frame (care mode)
   is labelled that way in the lightbox, not on the bar —
   the bar stays quiet. */

/* -----------------------------------------------------
   Mobile drawer
   The drawer has no spine, but the markers column keeps
   its 2.5rem lead; the bar still pulls left so it reads
   as the span it is. At 400px this leaves ~300px of bar.
   ----------------------------------------------------- */
#timeline-drawer-markers .timeline-reflection-bar {
    width: calc(100% + 1.5rem);
    margin-left: -1.5rem;
}

@media (max-width: 480px) {
    .timeline-reflection-bar {
        padding: 0.6rem 0.75rem 0.6rem 0.9rem;
    }
    .timeline-reflection-bar-period {
        font-size: 0.9rem;
    }
}

/* -----------------------------------------------------
   Request modal — the server's own words after a request
   ("It will appear on your timeline shortly …"), and the
   quiet follow-up while we watch for it to arrive.
   ----------------------------------------------------- */
.reflection-request-status {
    margin: 0.9rem 0 0;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.reflection-request-status:empty {
    display: none;
}

.reflection-request-status.is-error {
    background: var(--error-light);
    color: var(--error);
}

.reflection-request-status.is-arrived {
    background: rgba(74, 124, 89, 0.10);
    color: var(--success);
    font-weight: 500;
}

/* While a request is in flight or being watched for, the
   period options step back — one request at a time. */
.reflection-options.is-pending .reflection-option {
    opacity: 0.55;
    pointer-events: none;
}

/* -----------------------------------------------------
   Lightbox — reading a reflection
   Uses the shared modal pattern (modals.css); only the
   inner layout lives here.
   ----------------------------------------------------- */
.reflection-read-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.reflection-read-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--bar-accent, var(--gold));
}

.reflection-read-avatar[hidden] {
    display: none;
}

.reflection-read-period {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--text-primary);
}

.reflection-read-companion {
    margin-top: 0.15rem;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--bar-ink, var(--gold-dark));
}

.reflection-read-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin: 0 0 1rem;
}

.reflection-read-title:empty {
    display: none;
}

.reflection-read-body {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.reflection-read-body p {
    margin: 0 0 1rem;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

/* The closing — whatever follows the '---' line in the
   letter — set apart in italics with a short rule above. */
.reflection-read-closing {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.reflection-read-closing p {
    margin: 0 0 0.6rem;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

.reflection-read-closing:empty {
    display: none;
}

/* Listening — the player when the narration exists, a
   plain line when it is still being prepared. */
.reflection-read-listen {
    margin-top: 1.5rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--bar-accent, var(--gold)) 10%, var(--bg-card));
}

@supports not (background: color-mix(in srgb, red 10%, white)) {
    .reflection-read-listen {
        background: var(--bg-secondary);
    }
}

.reflection-read-listen-label {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bar-ink, var(--gold-dark));
    margin-bottom: 0.5rem;
}

.reflection-read-listen audio {
    width: 100%;
    display: block;
}

.reflection-read-listen-pending {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* The lightbox modal is a little wider than the default so
   a letter reads comfortably; still full-width on a phone. */
#modal-reflection-read .modal {
    max-width: 640px;
}
