/* =====================================================
   HONESTLY, E — People I care for (the witness surface)
   A daughter who arranged Ellen's calls for her mother, a
   son who gave a Life Story as a gift: this is where they
   look in. The sidebar tile, the modal that lists the
   people, and the one person's page inside it — the six
   eras with their photographs, the letters, the book, and
   the calls on the books.

   Ellen's rose runs through all of it (--ellen-color in
   life-arcs-panel.css, --companion-ellen in reflections.css).
   Mobile first: everything stacks to one column and every
   line of text is 400 weight or heavier.
   Loaded after reflections.css.
   ===================================================== */

/* -----------------------------------------------------
   Sidebar tile — only drawn when there is someone to see
   ----------------------------------------------------- */
.sidebar-section[hidden] { display: none; }

.witness-sidebar-btn {
    border-left: 3px solid var(--ellen-color, #B07B7B);
}
.witness-sidebar-btn:hover {
    border-color: var(--ellen-color, #B07B7B);
    background: rgba(176, 123, 123, 0.08);
}
.witness-sidebar-btn .sidebar-link-title { color: var(--text-primary); }
.witness-sidebar-btn .sidebar-link-subtitle {
    font-style: normal;
    color: var(--companion-ellen-deep, #874F4F);
    font-weight: 500;
}

/* -----------------------------------------------------
   The modal
   ----------------------------------------------------- */
#modal-witness .modal { max-width: 880px; }

#modal-witness .modal-title {
    color: var(--companion-ellen-deep, #874F4F);
}

.witness-intro {
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0 0 1rem;
}

.witness-loading,
.witness-empty,
.witness-error {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-secondary);
    padding: 1rem 0.25rem;
}
.witness-error { color: var(--error); font-style: normal; }
.witness-loading:empty,
.witness-error:empty { display: none; }

/* -----------------------------------------------------
   The list of people
   ----------------------------------------------------- */
.witness-people { display: flex; flex-direction: column; gap: 0.65rem; }

.witness-person-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    text-align: left;
    padding: 0.9rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--ellen-color, #B07B7B);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.witness-person-card:hover,
.witness-person-card:focus-visible {
    background: rgba(176, 123, 123, 0.07);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
    outline: none;
}

.witness-person-initial {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ellen-color, #B07B7B);
    color: #fff;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 500;
}

.witness-person-body { flex: 1; min-width: 0; }

.witness-person-name {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--text-primary);
}

.witness-person-line {
    margin-top: 0.2rem;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--text-secondary);
}
.witness-person-line strong { color: var(--text-primary); font-weight: 600; }

.witness-person-arrow {
    flex-shrink: 0;
    color: var(--companion-ellen-deep, #874F4F);
    font-size: 1.2rem;
}

/* -----------------------------------------------------
   One person
   ----------------------------------------------------- */
.witness-back {
    background: none;
    border: none;
    padding: 0 0 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--companion-ellen-deep, #874F4F);
    cursor: pointer;
}
.witness-back:hover { text-decoration: underline; }

.witness-person-head {
    padding-bottom: 0.9rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--border-light);
}

.witness-person-head-name {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.witness-person-head-line {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.witness-person-head-line strong { color: var(--text-primary); font-weight: 600; }

.witness-care-tag {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.55rem;
    border-radius: var(--radius-full);
    background: rgba(176, 123, 123, 0.14);
    color: var(--companion-ellen-deep, #874F4F);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

/* Section headings inside the person's page */
.witness-section { margin-bottom: 1.5rem; }

.witness-section-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--companion-ellen-deep, #874F4F);
    margin: 0 0 0.25rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(176, 123, 123, 0.35);
}

.witness-section-sub {
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0.35rem 0 0.75rem;
}

/* -----------------------------------------------------
   The six eras — cards with a strip of photographs
   ----------------------------------------------------- */
.witness-eras {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 640px) {
    .witness-eras { grid-template-columns: 1fr 1fr; }
}

.witness-era {
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.8rem 0.9rem 0.9rem;
    background: var(--bg-card);
}
.witness-era.touched { border-left-color: rgba(176, 123, 123, 0.5); }
.witness-era.covered { border-left-color: var(--ellen-color, #B07B7B); }

.witness-era-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.witness-era-name {
    font-family: var(--font-serif);
    font-size: 1.02rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--text-primary);
}

/* The same three badges the Life Arcs panel uses. */
.witness-era-status {
    flex-shrink: 0;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}
.witness-era-status.unexplored { color: var(--text-secondary); background: var(--bg-secondary); }
.witness-era-status.touched { color: var(--companion-ellen-deep, #874F4F); background: rgba(176, 123, 123, 0.14); }
.witness-era-status.covered { color: #fff; background: var(--ellen-color, #B07B7B); }

.witness-era-bar {
    height: 4px;
    margin: 0.15rem 0 0.45rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.witness-era-bar-fill {
    height: 100%;
    background: var(--ellen-color, #B07B7B);
    border-radius: var(--radius-full);
    transition: width 400ms ease;
}

.witness-era-meta {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary);
    margin-bottom: 0.55rem;
}

/* The photo strip: four squares, always four, so an empty
   slot reads as a place a picture could go. */
.witness-era-photos-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--companion-ellen-deep, #874F4F);
    margin-bottom: 0.4rem;
}

.witness-photo-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.witness-photo {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
.witness-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.witness-photo:hover img,
.witness-photo:focus-visible img { opacity: 0.85; }
.witness-photo:focus-visible { outline: 2px solid var(--ellen-color, #B07B7B); outline-offset: 1px; }

/* A picture with a caption carries a small mark in its corner. */
.witness-photo-captioned::after {
    content: '';
    position: absolute;
    right: 5px;
    bottom: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px var(--ellen-color, #B07B7B);
}

/* The add slot: a dashed square with a plus. Sits where the
   next picture will go; gone when the era holds four. */
.witness-photo-add {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--ellen-color, #B07B7B);
    background: rgba(176, 123, 123, 0.05);
    color: var(--companion-ellen-deep, #874F4F);
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1;
}
.witness-photo-add:hover { background: rgba(176, 123, 123, 0.12); }
.witness-photo-add[disabled] { opacity: 0.5; cursor: wait; }

/* Empty slots after the add button: quiet squares. */
.witness-photo-empty {
    border-style: dashed;
    border-color: var(--border-light);
    background: transparent;
    cursor: default;
}

.witness-photo-input { display: none; }

.witness-photo-note {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-secondary);
}
.witness-photo-note.is-error { color: var(--error); }
.witness-photo-note:empty { display: none; }

/* Editing one picture: a preview, a caption line, and the
   buttons. Opens inside the era card, under the strip. */
.witness-photo-edit {
    margin-top: 0.6rem;
    padding: 0.7rem;
    border-radius: var(--radius-sm);
    background: rgba(176, 123, 123, 0.07);
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.6rem;
    align-items: start;
}
.witness-photo-edit img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
}
.witness-photo-edit-fields { min-width: 0; }
.witness-photo-edit label {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--companion-ellen-deep, #874F4F);
    margin-bottom: 0.25rem;
}
.witness-photo-edit input[type="text"] {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-card);
}
.witness-photo-edit input[type="text"]:focus {
    outline: none;
    border-color: var(--ellen-color, #B07B7B);
}
.witness-photo-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

/* Small rose buttons used throughout the person's page. */
.witness-btn {
    display: inline-block;
    background: none;
    border: 1px solid var(--ellen-color, #B07B7B);
    color: var(--companion-ellen-deep, #874F4F);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.witness-btn:hover { background: var(--ellen-color, #B07B7B); color: #fff; }
.witness-btn.solid { background: var(--ellen-color, #B07B7B); color: #fff; }
.witness-btn.solid:hover { background: var(--companion-ellen-deep, #874F4F); }
.witness-btn.quiet { border-color: var(--border-medium); color: var(--text-secondary); }
.witness-btn.quiet:hover { background: var(--bg-hover); color: var(--text-primary); }
.witness-btn[disabled] { opacity: 0.55; cursor: default; }
.witness-btn[disabled]:hover { background: none; color: var(--companion-ellen-deep, #874F4F); }
.witness-btn.solid[disabled]:hover { background: var(--ellen-color, #B07B7B); color: #fff; }

/* -----------------------------------------------------
   The letters — the era letters first, then the weeks
   ----------------------------------------------------- */
.witness-letters { display: flex; flex-direction: column; gap: 0.5rem; }

.witness-letter {
    --bar-accent: var(--companion-ellen, #B07B7B);
    --bar-ink: var(--companion-ellen-deep, #874F4F);
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.9rem 0.65rem 1rem;
    border: none;
    border-left: 4px solid var(--bar-accent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--bar-accent) 13%, var(--bg-card));
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
    .witness-letter { background: var(--bg-secondary); }
}
.witness-letter:hover,
.witness-letter:focus-visible {
    background: color-mix(in srgb, var(--bar-accent) 20%, var(--bg-card));
    box-shadow: var(--shadow-sm);
    transform: translateX(2px);
    outline: none;
}

/* Another companion's letter carries that companion's pair. */
.witness-letter.companion-ellie { --bar-accent: var(--companion-ellie); --bar-ink: var(--companion-ellie-deep); }
.witness-letter.companion-ellis { --bar-accent: var(--companion-ellis); --bar-ink: var(--companion-ellis-deep); }
.witness-letter.companion-essie { --bar-accent: var(--companion-essie); --bar-ink: var(--companion-essie-deep); }
.witness-letter.companion-ezra  { --bar-accent: var(--companion-ezra);  --bar-ink: var(--companion-ezra-deep); }
.witness-letter.companion-emory { --bar-accent: var(--companion-emory); --bar-ink: var(--companion-emory-deep); }
.witness-letter.companion-erik  { --bar-accent: var(--companion-erik);  --bar-ink: var(--companion-erik-deep); }
.witness-letter.companion-eddie { --bar-accent: var(--companion-eddie); --bar-ink: var(--companion-eddie-deep); }
.witness-letter.companion-elias { --bar-accent: var(--companion-elias); --bar-ink: var(--companion-elias-deep); }
.witness-letter.companion-ella  { --bar-accent: var(--companion-ella);  --bar-ink: var(--companion-ella-deep); }
.witness-letter.companion-elif  { --bar-accent: var(--companion-elif);  --bar-ink: var(--companion-elif-deep); }
.witness-letter.companion-ember { --bar-accent: var(--companion-ember); --bar-ink: var(--companion-ember-deep); }

.witness-letter-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}
.witness-letter-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-primary);
}
.witness-letter-play {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bar-ink);
}
.witness-letter-by {
    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);
}
.witness-letter-date {
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-secondary);
}

/* -----------------------------------------------------
   The Life Story — the button, the progress, the books
   ----------------------------------------------------- */
.witness-book-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.9rem;
    margin-bottom: 0.75rem;
}
.witness-book-note {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary);
    flex: 1 1 200px;
}

/* Progress reuses the book classes from modals.css; the
   fill goes rose here. */
#witness-book-progress .book-progress { margin-top: 0.25rem; padding-top: 0.5rem; }
#witness-book-progress .book-bar-fill { background: var(--ellen-color, #B07B7B); }
#witness-book-progress .book-progress-done a { color: var(--companion-ellen-deep, #874F4F); }

.witness-artifacts { margin-top: 0.75rem; }
.witness-artifacts .artifact-card { margin-bottom: 0.6rem; }
.witness-artifacts .artifact-card-badge { background: var(--ellen-color, #B07B7B); }
.witness-artifacts .artifact-card:hover { border-color: var(--ellen-color, #B07B7B); }
.witness-artifacts .artifact-card-actions a:hover,
.witness-artifacts .artifact-card-actions button:hover {
    background: var(--ellen-color, #B07B7B);
    border-color: var(--ellen-color, #B07B7B);
}
.witness-artifacts .artifact-card-meta { color: var(--text-secondary); }

/* -----------------------------------------------------
   The calls — next call and the standing days, read-only
   ----------------------------------------------------- */
.witness-calls { display: flex; flex-direction: column; gap: 0.5rem; }

.witness-call-line {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-secondary);
}
.witness-call-line strong { color: var(--text-primary); font-weight: 600; }
.witness-call-label {
    flex-shrink: 0;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--companion-ellen-deep, #874F4F);
    min-width: 5.5rem;
}

/* -----------------------------------------------------
   Settings — "I'd like extra patience"
   ----------------------------------------------------- */
#toggle-extra-patience.active { background: var(--ellen-color, #B07B7B); }

/* -----------------------------------------------------
   Phone widths
   ----------------------------------------------------- */
@media (max-width: 480px) {
    .witness-person-card { padding: 0.8rem 0.85rem; }
    .witness-person-initial { width: 40px; height: 40px; font-size: 1.1rem; }
    .witness-person-head-name { font-size: 1.35rem; }
    .witness-photo-strip { gap: 0.3rem; }
    .witness-call-line { flex-direction: column; gap: 0.15rem; }
    .witness-call-label { min-width: 0; }
    .witness-photo-edit { grid-template-columns: 60px 1fr; }
    .witness-photo-edit img { width: 60px; height: 60px; }
}
