/* Digital Lifeline: phone first. Body text at least 16px, tap targets at least 44px, high contrast. */

:root {
    --bg: #faf7f2;
    --surface: #ffffff;
    --ink: #1f2421;
    --muted: #59605b;
    --line: #e2ddd3;
    --accent: #1f5f5b;
    --accent-ink: #ffffff;
    --danger: #a4262c;
}

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
}

h1 { font-size: 1.8rem; }
h1:focus { outline: none; }

a { color: var(--accent); }

.btn { min-height: 44px; }

.btn-primary {
    color: var(--accent-ink);
    background-color: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #174845;
    border-color: #174845;
}

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--accent);
}

.form-check-input { width: 1.4em; height: 1.4em; margin-top: 0.1em; }
.form-check-label { padding-left: 0.4em; }

/* A single column for forms and short pages. */
main.narrow { max-width: 480px; margin: 0 auto; }

.muted { color: var(--muted); }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

.blazor-error-boundary {
    padding: 1rem;
    color: white;
    background: var(--danger);
}

.blazor-error-boundary::after { content: "Something went wrong."; }

section { margin: 32px 0; }

/* A link to send someone, with its copy and share buttons. */
.share-link {
    margin: 16px 0;
    padding: 16px;
    border: 2px solid var(--accent);
    border-radius: 12px;
    background: var(--surface);
}
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.member-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.member-actions .form-select { width: auto; min-height: 44px; }

/* The date box's live reading of what was typed. */
.date-preview { margin-top: 4px; color: var(--muted); font-size: 0.95rem; }
.date-preview strong { color: var(--ink); }
.date-problem { color: var(--danger); }

.problems { padding-left: 1.2em; }

/* Lists of people and the like: one tappable row each. */
.rows { list-style: none; padding: 0; margin: 0; }
.rows > li > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
}
.rows .detail { color: var(--muted); font-size: 0.95rem; }
.badge-lifeline {
    flex: none;
    padding: 2px 10px;
    border-radius: 999px;
    background: #e3efed;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
}

.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 16px 0; }
.facts dt { color: var(--muted); font-weight: normal; }
.facts dd { margin: 0; }
.bio { white-space: pre-line; }

/* Maps: a pin for an exact spot, a label for "somewhere in" a country. The attribution always shows. */
.place-map { height: 300px; border-radius: 12px; border: 1px solid var(--line); margin: 8px 0 16px; z-index: 0; }
.map-pin {
    width: 26px; height: 26px;
    background: var(--accent);
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.map-label span {
    display: inline-block;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    transform: translate(-50%, -50%);
}
.leaflet-control-attribution { font-size: 12px; }

.search-results { list-style: none; padding: 0; margin: 8px 0; }
.search-results button { width: 100%; text-align: left; min-height: 48px; }
.attribution-note { font-size: 0.85rem; color: var(--muted); }
.similar { border: 2px solid #c9a227; border-radius: 12px; padding: 12px 16px; background: #fff8e1; margin: 16px 0; }

/* Stories and their tellings. */
.story-when { color: var(--muted); font-size: 1.05rem; }
.people-chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.people-chips li { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.telling { margin: 12px 0 20px; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); scroll-margin-top: 72px; }
.telling-when { margin: 12px 0 8px; color: var(--muted); font-size: 0.9rem; }
/* Several tellings sit side by side: a row to swipe on a phone (the next one peeking in), columns when there's room. */
.telling-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 4px; }
.telling-tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.tellings.side-by-side { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 12px; padding: 0 16px 8px; scroll-padding: 0 16px; }
.tellings.side-by-side .telling { flex: 0 0 86%; margin: 12px 0 8px; scroll-snap-align: start; }
@media (min-width: 720px) {
    .tellings.side-by-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); overflow: visible; margin: 0 0 12px; padding: 0; }
    .tellings.side-by-side .telling { margin: 12px 0 0; }
}
.telling-by { margin-bottom: 8px; color: var(--muted); }
.telling-by strong { color: var(--ink); }
.pick-people { list-style: none; padding: 0; margin: 0; }
.pick-people > li { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.pick-people > li.chosen { background: #eef5f4; }
.pick-details { margin: 8px 0 4px 2em; }

/* Photos: a grid of square thumbnails, and the uploader's list. */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin: 16px 0; }
.photo-thumb { position: relative; display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #e9e4da; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 6px; text-align: center; font-size: 0.85rem; color: var(--muted); }
.photo-state.failed { color: var(--danger); }
.uploader { margin: 16px 0 24px; padding: 16px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--surface); }
.upload-list { list-style: none; padding: 0; margin: 12px 0; }
.upload-list li { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.upload-list progress { width: 100%; height: 10px; accent-color: var(--accent); }
.upload-name { font-weight: 600; overflow-wrap: anywhere; }
.upload-list li.added .upload-result { color: var(--accent); }
.upload-list li.duplicate .upload-result { color: #8a6d1d; }
.upload-list li.refused .upload-result { color: var(--danger); }

/* One photo, large, with its caption and credit. */
.photo-large { margin: 0 -16px 16px; }
.photo-large img { display: block; width: 100%; height: auto; max-height: 80vh; object-fit: contain; background: #1f1c18; }
.photo-large figcaption { padding: 8px 16px 0; }
.photo-large .caption { display: block; font-size: 1.1rem; }
.photo-large .credit { display: block; color: var(--muted); font-size: 0.9rem; font-style: italic; }
.photo-placeholder { display: flex; align-items: center; justify-content: center; min-height: 220px; padding: 16px; text-align: center; color: var(--muted); background: #e9e4da; }
.camera-hint { margin: -8px 0 16px; padding: 8px 12px; border-radius: 8px; background: var(--surface); font-size: 0.95rem; }
.photo-editor { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }

/* A row with its own button beside the link, such as "Add a date". */
.rows > li.has-action { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.rows > li.has-action > a:first-child { flex: 1; border-bottom: none; }
.rows > li.has-action > a.btn { flex: none; display: inline-flex; align-items: center; min-height: 44px; min-width: auto; padding: 6px 12px; border-bottom: 1px solid var(--accent); color: var(--accent); }

/* The lifeline: numbered stops on the map, the card for the chosen one, and the stories in order. */
.lifeline-map-wrap { scroll-margin-top: 64px; }
.lifeline-map-wrap.playing .lifeline-map { height: 30vh; min-height: 180px; }
.lifeline-map { height: min(50vh, 460px); border-radius: 12px; border: 1px solid var(--line); margin: 8px 0 12px; z-index: 0; scroll-margin-top: 72px; }
.lifeline-stop span {
    display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid #fff;
    font-weight: 700; font-size: 0.95rem; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.lifeline-stop.vague span { background: #fff; color: var(--accent); border: 2px dashed var(--accent); }
.lifeline-stop.many span { border-radius: 10px; }
.lifeline-stop.chosen span { background: #c2562b; color: #fff; border: 3px solid #fff; transform: scale(1.2); }
.lifeline-cards { min-height: 60px; }
.lifeline-here { margin: 0 0 8px; font-weight: 600; }
.story-card { margin: 0 0 10px; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.story-card.chosen { border: 2px solid var(--accent); }
.story-card-top { display: flex; gap: 12px; align-items: flex-start; }
.story-card-thumb { flex: none; width: 72px; height: 72px; border-radius: 8px; object-fit: cover; }
.story-card .detail { color: var(--muted); font-size: 0.95rem; }
.story-card .opening { margin: 10px 0 8px; }
.story-card .btn { min-height: 44px; }
.also-on { display: inline-block; margin: 0 12px 4px 0; padding: 6px 0; }
.stop-number {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px;
    background: var(--accent); color: #fff; font-size: 0.85rem; font-weight: 700; vertical-align: 0.1em;
}
.lifeline-steps { display: flex; align-items: center; gap: 8px; margin: 4px 0 4px; }
.lifeline-steps .btn { flex: 1; min-height: 44px; min-width: 0; padding-left: 6px; padding-right: 6px; }
.lifeline-position { margin: 0 0 10px; text-align: center; font-size: 0.9rem; }

/* The timeline strip: a year per column on a line, swiped sideways. Years with stories are wide enough for their
   ticks (numbered as on the map; hollow for a story with no place yet), others thin, labelled each decade. */
.timeline-strip { position: relative; display: flex; align-items: flex-end; overflow-x: auto; margin: 4px -16px 8px; padding: 8px 16px 4px; }
.tl-year { position: relative; flex: none; width: 10px; min-height: 76px; display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; padding-bottom: 30px; }
.tl-year.decade { width: 40px; }
.tl-year.has { width: 54px; }
.tl-year::before { content: ""; position: absolute; left: 0; right: 0; bottom: 20px; border-bottom: 2px solid var(--accent); }
.tl-year::after { content: ""; position: absolute; left: 50%; bottom: 20px; height: 8px; border-left: 1px solid var(--accent); }
.tl-label { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); line-height: 18px; font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.tl-year.has .tl-label { color: var(--ink); font-weight: 600; }
.tl-tick {
    position: relative; z-index: 1; width: 44px; height: 44px; padding: 0; border-radius: 50%;
    border: 2px solid #fff; background: var(--accent); color: #fff; font-weight: 700; font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.tl-tick.no-place { background: #fff; border: 2px dashed var(--accent); box-shadow: none; }
.tl-tick.chosen, .tl-tick.no-place.chosen { background: #c2562b; color: #fff; border: 2px solid #fff; box-shadow: 0 0 0 2px #c2562b; }
.lifeline-order { list-style: none; padding: 0; margin: 0; }
.lifeline-order button {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 4px;
    border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: left; font: inherit;
}
.lifeline-order button.chosen { background: #e3efed; }
.lifeline-order .detail { color: var(--muted); font-size: 0.95rem; }

/* The trash. */
.trash-list > li { align-items: flex-start; }
.trash-item { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 220px; }
.trash-thumb { flex: none; width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #e9e4da; }
.trash-kind { display: inline-block; margin-bottom: 2px; color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.trash-list .detail { color: var(--muted); font-size: 0.95rem; }
.trash-confirm { flex: 1 1 100%; padding: 12px; border-radius: 10px; background: #fbeeea; }

/* Admin's backup facts: red when something needs attention. */
.backup-facts dd.warn { color: var(--danger); font-weight: 600; }
.backup-facts dd span { font-weight: 400; }
.story-card h2 .stop-number { margin-right: 6px; }

/* A person's photo beside their name, and choosing it. */
.person-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.person-head h1 { margin-bottom: 0; }
.portrait { display: block; width: 96px; height: 96px; border-radius: 50%; object-fit: cover; object-position: 50% 30%; border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); background: #e9e4da; }
.rows .portrait { width: 48px; height: 48px; border-width: 2px; flex: none; }
.photo-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.photo-choice { padding: 0; aspect-ratio: 1; border: 3px solid transparent; border-radius: 10px; overflow: hidden; background: #e9e4da; }
.photo-choice img { width: 100%; height: 100%; object-fit: cover; }
.photo-choice.chosen { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface) inset; }

/* A place's photos: then and now side by side, and every photo with its date. */
.then-now { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 20px; }
.then-now figure { margin: 0; }
.then-now img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #e9e4da; }
.then-now figcaption { margin-top: 6px; font-size: 0.95rem; }
.photo-grid.dated figure { margin: 0; }
.photo-grid.dated figcaption { margin-top: 4px; font-size: 0.8rem; color: var(--muted); text-align: center; line-height: 1.2; }

/* Search: the box (on Home and the search page) and the results. */
.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form .form-control { flex: 1; min-width: 0; }
.search-results-list .excerpt { display: block; margin-top: 4px; color: var(--ink); font-size: 0.95rem; }
mark { padding: 0 1px; border-radius: 3px; background: #fbe7a1; color: inherit; }

/* Recent changes. */
.change-list > li { align-items: flex-start; }
.change { flex: 1 1 220px; }
.change-details { margin: 0 0 4px; padding-left: 18px; color: var(--ink); font-size: 0.95rem; }
.change-list > li.undone .change > p, .change-list > li.undone .change-details { color: var(--muted); text-decoration: line-through; }
.undone-note { color: var(--muted); }

/* Tags: boxes on a photo naming who's there. On the photo page they show when "Show who's who" is on; while
   tagging they always show. */
.tag-frame { position: relative; }
.tag-frame img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.tag-box { position: absolute; display: none; border: 2px solid #fff; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); text-decoration: none; }
.tag-box.unknown { border-style: dashed; }
.tag-label { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 4px); padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 0.8rem; white-space: nowrap; }
.show-tags:checked ~ .photo-large .tag-box, .tag-frame.drawing .tag-box { display: block; }
.in-this-photo { margin: 4px 0 12px; }
.show-tags-switch { display: inline-flex; align-items: center; min-height: 44px; margin-left: 8px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--accent); cursor: pointer; }
.show-tags:checked ~ .in-this-photo .show-tags-switch { background: var(--accent); color: #fff; border-color: var(--accent); }
.show-tags:focus-visible ~ .in-this-photo .show-tags-switch { outline: 3px solid var(--accent); outline-offset: 2px; }
.tagger { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.tag-frame.drawing { touch-action: none; cursor: crosshair; margin: 8px 0; border-radius: 8px; overflow: hidden; }
.tag-frame.drawing .tag-box { pointer-events: none; }
.tag-frame.drawing .tag-label { top: auto; bottom: 100%; transform: translate(-50%, -2px); }
.tag-box.pending, .tag-drawing { position: absolute; display: block; border: 2px dashed #ffd84d; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); border-radius: 6px; pointer-events: none; }
.tag-box.moving { border-color: #ffd84d; }
.tag-form { margin: 8px 0 12px; }
.tag-who { width: auto; min-width: 0; flex: 1 1 160px; min-height: 44px; }

/* Help identify: the faces nobody has named, the gaps in words, the banner while going through them, and Home's card. */
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.face-grid a { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; text-align: center; }
.portrait.face { width: 88px; height: 88px; }
.gap-thumb { flex: none; width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #e9e4da; }
.gap-missing { color: #8a4b12; font-size: 0.95rem; }
.identify-banner { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: #fff6dc; border: 1px solid #e8cf86; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); }
.identify-card { display: block; margin: 0 0 20px; padding: 14px 16px; border-radius: 12px; background: #fff6dc; border: 1px solid #e8cf86; color: var(--ink); text-decoration: none; }
.identify-card strong { display: block; font-size: 1.1rem; }
.identify-card span { color: #6b5414; }

/* Comments: a conversation under a story or photo. */
.comments { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); }
.comment { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); scroll-margin-top: 72px; }
.comment-by { margin-bottom: 4px; }
.comment-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.comment-actions form { margin: 0; }
.comment-actions .btn { min-height: 40px; }
.comment-new { margin-top: 8px; }

/* What's new on Home. */
.whats-new { margin-top: 28px; }
.news-day { margin: 16px 0 0; color: var(--muted); font-family: inherit; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.8rem; }
.news-quote { display: block; margin-top: 2px; color: var(--muted); font-size: 0.95rem; }
.news-photos { display: flex; gap: 4px; margin-top: 6px; }
.news-photos img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: #e9e4da; }

/* Two lifelines at once: the other person's in purple, places both reached ringed, stories they share marked. */
.compare { margin: 4px 0 8px; }
.compare-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 8px 0 0; font-size: 0.95rem; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-left: 4px; vertical-align: -2px; }
.swatch.mine { background: var(--accent); margin-left: 0; }
.swatch.theirs { background: #7b4fa0; }
.lifeline-stop.second span {
    display: flex; align-items: center; justify-content: center; height: 28px; border-radius: 14px;
    background: #7b4fa0; color: #fff; border: 2px solid #fff; font-weight: 700; font-size: 0.8rem; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.lifeline-stop.second.vague span { background: #fff; color: #7b4fa0; border: 2px dashed #7b4fa0; }
.lifeline-stop.crossed span { box-shadow: 0 0 0 3px #7b4fa0, 0 1px 4px rgba(0, 0, 0, 0.35); }
.tl-tick.shared { box-shadow: 0 0 0 3px #7b4fa0; }
.lifeline-here.theirs, .stop-number.theirs { color: #7b4fa0; }
.stop-number.theirs { background: #7b4fa0; color: #fff; }
.story-card.theirs { border: 2px solid #7b4fa0; }
.crossing-list > li { display: block; padding: 8px 0; }
.crossing { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; font: inherit; text-decoration: none; }
.crossing-place .detail { display: block; color: var(--muted); font-size: 0.95rem; }
.link-button { padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; font: inherit; }
