/* Stuff I've Done - site styles (loaded after Bootstrap 5.3) */

:root {
	--sid-bg:        #f6f3ee;   /* warm paper */
	--sid-surface:   #ffffff;
	--sid-ink:       #26303b;
	--sid-muted:     #6b7480;
	--sid-line:      #e4ded4;
	--sid-brand:     #1f4e5f;   /* deep teal */
	--sid-brand-2:   #2d6a7f;
	--sid-read:      #2e7d4f;   /* finished */
	--sid-reading:   #2a7fb0;   /* currently reading */
	--sid-wish:      #d99a1c;   /* wish list */
	--sid-star:      #f2a900;
	--bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { scroll-behavior: smooth; }

body {
	background: var(--sid-bg);
	color: var(--sid-ink);
	padding-top: 64px;           /* room for the fixed navbar */
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

a { color: var(--sid-brand-2); }
a:hover { color: var(--sid-brand); }

/* ---------- Navbar ---------- */
.site-nav { background: var(--sid-brand); box-shadow: 0 1px 8px rgba(0, 0, 0, .18); }
.site-nav .navbar-brand { font-weight: 700; letter-spacing: .02em; }
.site-nav .nav-link.active { font-weight: 600; box-shadow: inset 0 -3px 0 var(--sid-wish); }

/* ---------- Page frame ---------- */
.site-main { flex: 1 0 auto; padding-top: 1.5rem; padding-bottom: 3rem; max-width: 1140px; }
.site-footer { padding: 1.5rem 0; border-top: 1px solid var(--sid-line); }

.page-title { font-weight: 700; margin-bottom: .25rem; }
.page-lead  { color: var(--sid-muted); margin-bottom: 1.5rem; }

/* ---------- Status tabs (Finished / Reading / Wish list) ---------- */
.status-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.status-tabs a {
	flex: 1 1 10rem; text-align: center; text-decoration: none;
	padding: .65rem 1rem; border-radius: .6rem; font-weight: 600; color: #fff;
	opacity: .55; transition: opacity .15s, transform .15s;
}
.status-tabs a:hover  { opacity: .9; color: #fff; }
.status-tabs a.active { opacity: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.status-tabs .tab-read    { background: var(--sid-read); }
.status-tabs .tab-reading { background: var(--sid-reading); }
.status-tabs .tab-wish    { background: var(--sid-wish); }

/* ---------- Author section heading ---------- */
.author-heading {
	display: flex; align-items: baseline; justify-content: space-between;
	margin: 2rem 0 .75rem; padding-bottom: .4rem; border-bottom: 2px solid var(--sid-brand);
}
.author-heading h2 { font-size: 1.35rem; margin: 0; }
.author-heading a  { color: var(--sid-brand); text-decoration: none; }
.author-heading a:hover { text-decoration: underline; }
.author-heading .count { color: var(--sid-muted); font-size: .9rem; }

/* ---------- Book cover grid ---------- */
.book-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 1.25rem;
}
.book-card {
	background: var(--sid-surface); border: 1px solid var(--sid-line); border-radius: .6rem;
	padding: .6rem; text-align: center; transition: box-shadow .15s, transform .15s;
}
.book-card:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .12); transform: translateY(-2px); }
.book-card a { text-decoration: none; color: inherit; }
.book-card img {
	width: 100%; height: 210px; object-fit: contain; border-radius: .35rem;
	background: #efeae1;
}
.book-card .book-title { font-weight: 600; font-size: .9rem; margin: .5rem 0 .15rem; line-height: 1.25; }
.book-card .book-meta  { color: var(--sid-muted); font-size: .78rem; line-height: 1.35; }
.book-card.is-read    { border-bottom: 4px solid var(--sid-read); }
.book-card.is-reading { border-bottom: 4px solid var(--sid-reading); }
.book-card.is-wish    { border-bottom: 4px solid var(--sid-wish); }
.book-card.not-read   { opacity: .8; }

/* ---------- Star ratings ---------- */
.stars .fa-star       { color: #d6d0c4; }
.stars .fa-star.checked { color: var(--sid-star); }

/* ---------- Alphabet jump bar ---------- */
.az-bar { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1.5rem; }
.az-bar a {
	min-width: 2.1rem; text-align: center; padding: .25rem .4rem; border-radius: .4rem;
	background: var(--sid-surface); border: 1px solid var(--sid-line);
	text-decoration: none; font-weight: 600; font-size: .9rem;
}
.az-bar a:hover { background: var(--sid-brand); border-color: var(--sid-brand); color: #fff; }

.az-heading { scroll-margin-top: 80px; margin: 1.75rem 0 .75rem; font-weight: 700; color: var(--sid-brand); border-bottom: 2px solid var(--sid-line); }

/* ---------- Cards / forms ---------- */
.panel {
	background: var(--sid-surface); border: 1px solid var(--sid-line);
	border-radius: .75rem; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}
.form-label { font-weight: 600; }
.btn-brand { background: var(--sid-brand); border-color: var(--sid-brand); color: #fff; }
.btn-brand:hover { background: var(--sid-brand-2); border-color: var(--sid-brand-2); color: #fff; }

.login-wrap { max-width: 420px; margin: 2rem auto; }

/* ---------- Book rows (author page) ---------- */
.book-row {
	display: flex; flex-wrap: wrap; gap: 1.25rem; padding: 1rem;
	margin-bottom: 1rem; border-left: 6px solid var(--sid-line);
}
.book-row.is-read    { border-left-color: var(--sid-read); }
.book-row.is-reading { border-left-color: var(--sid-reading); }
.book-row.is-wish    { border-left-color: var(--sid-wish); }
.book-row-cover { flex: 0 0 130px; }
.book-row-cover img { width: 130px; height: auto; border-radius: .4rem; background: #efeae1; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.book-row-body { flex: 1 1 260px; min-width: 0; }
.book-row-body h2 a { text-decoration: none; color: var(--sid-ink); }
.book-row-body h2 a:hover { color: var(--sid-brand-2); }
.book-row-synopsis { flex: 0 0 110px; }
.book-row-synopsis img { width: 110px; height: auto; border-radius: .35rem; border: 1px solid var(--sid-line); }
.reader-line { font-size: .88rem; color: var(--sid-muted); }

.status-pill {
	display: inline-block; padding: .15rem .65rem; border-radius: 999px;
	font-size: .8rem; font-weight: 600; color: #fff;
}
.status-pill.is-read    { background: var(--sid-read); }
.status-pill.is-reading { background: var(--sid-reading); }
.status-pill.is-wish    { background: var(--sid-wish); }

/* ---------- Series strip (book page) ---------- */
.book-grid-sm { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: .9rem; }
.book-grid-sm .book-card { padding: .4rem; }
.book-grid-sm .book-card img { height: 150px; }
.book-card.current { outline: 3px solid var(--sid-brand); }
.book-card .series-no { font-weight: 700; color: var(--sid-brand); font-size: .85rem; }

/* ---------- Book detail ---------- */
.detail-cover img { max-width: 100%; max-height: 420px; border-radius: .5rem; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); background: #efeae1; }
.detail-list dt { color: var(--sid-muted); font-weight: 600; }
.detail-list dd { margin-bottom: .6rem; }
.suggest-box a { text-decoration: none; }
.suggest-box { background: var(--sid-surface); border: 1px solid var(--sid-line); border-radius: .5rem; padding: .25rem .75rem; margin-top: .25rem; }
.suggest-box:empty { display: none; }

/* ---------- Icon-only action buttons (with tooltips) ---------- */
.icon-btn {
	display: inline-flex; align-items: center; justify-content: center;
	background: none; border: 0; padding: .1rem .35rem; line-height: 1;
	font-size: 1.45rem; color: var(--sid-muted); cursor: pointer; text-decoration: none;
	transition: color .15s, transform .15s;
}
.icon-btn:hover, .icon-btn:focus-visible { transform: scale(1.12); }
.icon-btn.icon-add    { color: var(--sid-brand); }
.icon-btn.icon-add:hover    { color: var(--sid-read); }
.icon-btn.icon-remove:hover { color: #c0392b; }
a.icon-btn { font-size: 1.15rem; }
a.icon-btn:hover { color: var(--sid-brand); }

/* ---------- Star rating input (edit page) ---------- */
.star-rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; position: relative; }
.star-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-rating label { font-size: 2rem; line-height: 1; color: #d6d0c4; cursor: pointer; padding: 0 .12rem; transition: color .1s, transform .1s; }
.star-rating label:hover { transform: scale(1.15); }
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: var(--sid-star); }
.star-rating input:focus-visible + label { outline: 2px solid var(--sid-brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- Lists ---------- */
.list-card { transition: box-shadow .15s, transform .15s; color: var(--sid-ink); }
.list-card:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .12); transform: translateY(-2px); color: var(--sid-ink); }
.list-card h2 { color: var(--sid-brand); }

.list-row {
	display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; margin-bottom: .6rem;
	border-left: 6px solid var(--sid-line);
}
.list-row.is-read    { border-left-color: var(--sid-read); }
.list-row.is-reading { border-left-color: var(--sid-reading); }
.list-row.is-wish    { border-left-color: var(--sid-wish); }
.list-no { flex: 0 0 2.2rem; text-align: right; font-weight: 700; color: var(--sid-muted); font-size: 1.1rem; }
.list-cover { flex: 0 0 56px; width: 56px; }
.list-cover img { width: 56px; height: 84px; object-fit: contain; border-radius: .3rem; background: #efeae1; }
.list-series-icon { height: 84px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: var(--sid-brand); background: #efeae1; border-radius: .3rem; }
.list-main { flex: 1 1 auto; min-width: 0; }
.list-actions { flex: 0 0 auto; display: flex; align-items: center; gap: .1rem; }

/* Keep nav labels on one line; the bar collapses into the menu button below the xl breakpoint */
.site-nav .nav-link, .site-nav .navbar-text { white-space: nowrap; }

/* ---------- Test site marker (orange bar + strip) ---------- */
.site-nav.is-test { background: #a8531a; }
.test-banner { background: #fff0e0; color: #8a3f0c; border: 1px solid #f0c8a0; border-radius: .4rem; padding: .3rem .75rem; margin-bottom: 1rem; text-align: center; font-size: .85rem; }

/* ---------- Home page tiles ---------- */
.home-tile {
	display: block; height: 100%; padding: 1.75rem; border-radius: .9rem; text-decoration: none; color: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .12); transition: transform .15s, box-shadow .15s;
}
.home-tile:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0, 0, 0, .2); color: #fff; }
.home-tile h2 { color: #fff; }
.home-tile .tile-icon { font-size: 2.6rem; opacity: .9; margin-bottom: .6rem; display: block; }
.tile-books    { background: linear-gradient(135deg, #1f4e5f, #2d6a7f); }
.tile-holidays { background: linear-gradient(135deg, #b4631b, #d98a2b); }

/* ---------- Holidays ---------- */
.holiday-card { color: var(--sid-ink); transition: box-shadow .15s, transform .15s; }
.holiday-card:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .12); transform: translateY(-2px); color: var(--sid-ink); }
.holiday-card h2 { color: #b4631b; }
.role-badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: #fff0e0; color: #8a3f0c; border: 1px solid #f0c8a0; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.map-box { height: 340px; border-radius: .6rem; border: 1px solid var(--sid-line); z-index: 0; }

/* ---------- Map controls ---------- */
.maplibregl-ctrl-group button.stuffmap-names { width: auto; height: 29px; padding: 0 .55rem; font-size: 12px; font-weight: 600; color: #333; background: #fff; }
.maplibregl-ctrl-group button.stuffmap-names:hover { background: #f0f0f0; }
.map-box.maplibregl-map { font-family: inherit; }
.stuffmap-loading { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; background: #eef1f3; color: #6b7480; font-size: .95rem; pointer-events: none; }

/* ---------- Holiday photos ---------- */
.photo-card { background: #fff; border: 1px solid var(--sid-line); border-radius: .6rem; overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.photo-open { display: block; position: relative; overflow: hidden; background: #eee; aspect-ratio: 4 / 3; }
.photo-open img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-meta { padding: .5rem .65rem .65rem; }
.photo-caption { font-weight: 500; overflow-wrap: anywhere; }
.photo-strip img { height: 90px; width: 120px; object-fit: cover; border-radius: .4rem; border: 1px solid var(--sid-line); }

/* ---------- Holiday cards, list and diary list ---------- */
.holiday-cover { aspect-ratio: 16 / 9; background: #e9e5de; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.holiday-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.holiday-cover-empty { background: linear-gradient(135deg, #f3e3cf, #e8d2b6); color: #b4631b; font-size: 2.6rem; }
.holiday-people { cursor: help; border-bottom: 1px dotted currentColor; }
.holiday-row-dates { min-width: 14.5rem; font-variant-numeric: tabular-nums; }
.diary-list-row { color: var(--sid-ink); padding: .35rem .25rem; border-radius: .4rem; }
.diary-list-row:hover { background: rgba(0, 0, 0, .04); color: var(--sid-ink); }
.diary-list-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: .35rem; border: 1px solid var(--sid-line); flex: none; }
.diary-list-nothumb { display: inline-block; background: #eee; }
.day-choice { cursor: pointer; margin: 0; }
.day-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-choice img, .day-choice-none { display: block; width: 120px; height: 90px; object-fit: cover; border-radius: .4rem; border: 3px solid transparent; outline: 1px solid var(--sid-line); }
.day-choice-none { display: flex; align-items: center; justify-content: center; background: #f1efea; color: #6b7480; font-size: .85rem; }
.day-choice input:checked + img, .day-choice input:checked + .day-choice-none { border-color: #b4631b; }
.day-choice input:focus-visible + img, .day-choice input:focus-visible + .day-choice-none { outline: 2px solid #1f4e5f; }
.holiday-year { font-size: 1.15rem; font-weight: 700; color: #b4631b; margin: 1.5rem 0 .5rem; padding-bottom: .25rem; border-bottom: 2px solid #f0c8a0; }
.holiday-year:first-of-type { margin-top: 0; }

/* ---------- Start from your photos ---------- */
.start-thumb { height: 60px; width: auto; border-radius: .3rem; border: 1px solid var(--sid-line); }
.start-off { opacity: .55; }

/* ---------- Choosing which photos (Start from your photos) ---------- */
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .5rem; max-height: 26rem; overflow-y: auto; padding: .25rem; border: 1px solid var(--sid-line); border-radius: .5rem; background: #fff; }
.start-cell { position: relative; display: block; margin: 0; cursor: pointer; font-size: .7rem; text-align: center; color: #6b7480; }
.start-cell input { position: absolute; top: .3rem; left: .3rem; z-index: 2; width: 1.15rem; height: 1.15rem; cursor: pointer; }
.start-cell-img { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 3; background: #eee; border-radius: .35rem; overflow: hidden; }
.start-cell-img canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.start-cell-off .start-cell-img { opacity: .3; filter: grayscale(1); }
.start-cell-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Phones (narrower than 576px) ---------- */
@media (max-width: 575.98px) {
	.page-title { font-size: 1.7rem; line-height: 1.2; }
	.page-lead { font-size: .95rem; }
	.panel { padding: 1rem; }
	/* easier to tap */
	.btn-sm { padding: .5rem .8rem; font-size: .9rem; }
	.photo-meta a, .photo-meta .btn-link { display: inline-block; padding: .4rem 0; font-size: .85rem; text-align: left; }
	.photo-meta .btn-link { text-decoration: underline; vertical-align: baseline; }
	/* shorter maps, so the page can still be scrolled past them */
	.map-box { height: 240px; }
	/* photo strips: three across */
	.photo-strip { gap: .4rem !important; }
	.photo-strip img { width: calc((100vw - 5.5rem) / 3); height: auto; aspect-ratio: 4 / 3; }
	/* the list of holidays: the dates on a line of their own above the title */
	.holiday-row-dates { min-width: 0; flex: 0 0 100%; font-size: .85rem; }
	/* tables that stack: one block per row, each cell on its own line */
	table.stack-sm thead { display: none; }
	table.stack-sm, table.stack-sm tbody { display: block; }
	table.stack-sm tr { display: block; padding: .6rem 0; border-bottom: 1px solid var(--sid-line); }
	table.stack-sm td { display: block; border: 0; padding: .2rem 0; }
	table.stack-sm td.text-end { text-align: left !important; }
	table.stack-sm td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: #6b7480; }
	table.stack-sm select { max-width: none !important; width: 100%; }
	/* review cards of "Start from your photos": the Find button under the place box */
	.start-group .input-group { flex-wrap: wrap; }
	.start-group .input-group .form-control { flex: 0 0 100%; border-radius: .375rem !important; }
	.start-group .input-group .btn { margin: .4rem 0 0 !important; border-radius: .375rem !important; }
	.start-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: 22rem; }
}
@media (max-width: 575.98px) { .photo-meta .role-badge { white-space: normal; } }
@media (max-width: 575.98px) {
	/* holiday page: the photos and the diary come before the map and the list of people */
	.view-body { display: flex; flex-direction: column; }
	.view-body > .view-map-row { order: 5; }
}
