/*
 * Star Library.
 *
 * A module stylesheet, served directly rather than folded into the theme
 * pipeline, so the UPDATECODE constant in ChannelsThemes/classes/Theme.php is
 * not involved. Colours come from the site theme wherever possible; this file
 * only lays things out.
 *
 * Claude Code / 14th September 2026
 */

.starlibrary { max-width: 60rem; margin: 0 auto; }

.starlibrary-visually-hidden {
	position: absolute;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Search and counts */

.starlibrary-count { margin: 0; opacity: 0.8; }

.starlibrary-section-heading { margin: 2rem 0 1rem; text-align: left; font-size: 1.3em; }

/*
 * The homepage layout.
 *
 * Two columns: the library, and a stacked column of actions beside it. The
 * actions never push the memories down the page, and the memories start
 * immediately under the introduction.
 *
 * Buttons are the theme's own `dc-button`, not a class of ours. The theme
 * underlines every anchor through an `A:link` rule that outranks a single
 * class selector, so rolling our own meant an underline we could not remove
 * without !important, and a control that looked foreign on the page.
 */

.starlibrary-layout {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1.5rem 2rem;
}

.starlibrary-main { flex: 1 1 22rem; min-width: 0; }

.starlibrary-aside {
	flex: 0 0 15rem;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	margin-left: auto;
}

/* dc-button carries its own 3px margin, so the column needs no gap */
.starlibrary-aside .dc-button { width: 100%; box-sizing: border-box; }

.starlibrary-intro { margin-bottom: 1rem; }

.starlibrary-hero-lead {
	font-size: 1.15em;
	line-height: 1.6;
	max-width: 44rem;
	margin: 0 0 1rem;
}

.starlibrary-hero-closed { margin: 0; opacity: 0.8; }

.starlibrary-more { margin: 1.5rem 0 0; }

/*
 * The search bar, behind a magnifying glass.
 *
 * Hidden until asked for, because an empty search box at the top of a small
 * library is a question nobody asked. Closing it clears the box, so reopening
 * it never presents a stale search as though it were in force.
 *
 * The [hidden] rule is load bearing: the browser's own `[hidden]{display:none}`
 * is a bare attribute selector and loses to the `display: flex` below it, so
 * without this the bar was simply always open.
 */

.starlibrary-search { margin: 0 0 1.5rem; }

.starlibrary-search .starlibrary-count {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0;
}

.starlibrary-search-toggle {
	line-height: 1;
	padding: 0.3rem 0.6rem;
	font-size: 1em;
	cursor: pointer;
}

.starlibrary-search-form {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.5rem;
	align-items: center;
	margin-top: 0.75rem;
	max-width: 32rem;
}

.starlibrary-search-form[hidden] { display: none; }

/* The form rules give every input 100% width, which broke the row in two */
.starlibrary .starlibrary-search-form input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	width: auto;
	margin: 0;
}

.starlibrary-search-form button { flex: 0 0 auto; white-space: nowrap; }

/* The filters and categories that close the homepage */

.starlibrary-footer-filters {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid rgba(0,0,0,0.1);
}

/*
 * The browse page.
 *
 * Every control is labelled. The unlabelled row of boxes this replaced gave a
 * reader three drop downs and no idea what any of them would do.
 */

.starlibrary-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 1rem;
	padding: 1rem 1.25rem;
	margin-bottom: 1.5rem;
	border: 1px solid rgba(0,0,0,0.12);
	border-radius: 0.4rem;
	background: rgba(0,0,0,0.02);
}

.starlibrary-filter { display: flex; flex-direction: column; gap: 0.3rem; }

.starlibrary .starlibrary-filter label {
	margin: 0;
	font-size: 0.85em;
	font-weight: bold;
	opacity: 0.75;
}

.starlibrary-filter-query { flex: 1 1 16rem; }

.starlibrary .starlibrary-filter-query input[type="search"] { width: 100%; }

.starlibrary-filter-check { justify-content: flex-end; }

.starlibrary .starlibrary-filter-check .starlibrary-checkbox {
	margin: 0;
	font-weight: normal;
	font-size: 0.95em;
	white-space: nowrap;
}

.starlibrary-filter-actions { flex-direction: row; align-items: center; gap: 1rem; }

.starlibrary-filter-clear { font-size: 0.9em; opacity: 0.75; }

.starlibrary-results-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.25rem;
}

.starlibrary-results-bar .starlibrary-language-filter { margin-bottom: 0; }

.starlibrary-results-bar .starlibrary-count { font-size: 1.05em; opacity: 1; }

/* A narrow screen has no room for a column beside the text */

@media (max-width: 40rem) {

	.starlibrary-actions {
		float: none;
		width: auto;
		max-width: none;
		margin: 0 0 1.5rem 0;
	}

	.starlibrary-filters { flex-direction: column; align-items: stretch; }

	.starlibrary .starlibrary-filter-query input[type="search"] { min-width: 0; }
}

.starlibrary-empty-state {
	padding: 2.5rem 1.5rem;
	text-align: center;
	border: 1px dashed rgba(0,0,0,0.2);
	border-radius: 0.4rem;
}

.starlibrary-empty-state h2 { margin-top: 0; }

/* Category chips: the homepage's compact form */

.starlibrary-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
}

.starlibrary-chip {
	display: inline-flex;
	align-items: baseline;
	gap: 0.4rem;
	padding: 0.35rem 0.8rem;
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 1.2rem;
	font-size: 0.9em;
	text-decoration: none;
	white-space: nowrap;
}

.starlibrary-chip:hover,
.starlibrary-chip:focus { border-color: rgba(0,0,0,0.4); }

.starlibrary-chip-count { font-size: 0.85em; opacity: 0.6; }

.starlibrary-chip-all { font-weight: bold; }

.starlibrary-report-image { display: block; font-size: 0.8em; opacity: 0.6; margin-top: 0.2rem; }

.starlibrary-report-scope { display: block; font-size: 0.9em; opacity: 0.75; }

/* Category tiles: the fuller form, used on the about page */

.starlibrary-categories {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
	gap: 1rem;
	margin-bottom: 2rem;
}

.starlibrary-category-tile {
	display: block;
	padding: 1rem;
	border: 1px solid rgba(0,0,0,0.12);
	border-radius: 0.4rem;
	text-decoration: none;
}

.starlibrary-category-tile img { width: 100%; height: auto; border-radius: 0.3rem; }

.starlibrary-category-name { display: block; font-weight: bold; margin-top: 0.5rem; }

.starlibrary-category-description { display: block; font-size: 0.9em; opacity: 0.75; }

.starlibrary-category-count { display: block; font-size: 0.85em; opacity: 0.6; margin-top: 0.35rem; }

/* The category selector on the drafts form */

.starlibrary-category-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
	gap: 0.5rem 1.25rem;
	margin-top: 0.75rem;
}

.starlibrary-category-option {
	display: grid;
	grid-template-columns: auto 1fr;
	grid-template-areas: "box name" ". help";
	gap: 0 0.5rem;
	align-items: baseline;
	margin: 0;
	padding: 0.4rem 0.5rem;
	border-radius: 0.3rem;
	font-weight: normal;
	cursor: pointer;
}

.starlibrary-category-option:hover { background: rgba(0,0,0,0.04); }

.starlibrary-category-option input { grid-area: box; width: auto; }

.starlibrary-category-option-name { grid-area: name; font-weight: bold; }

.starlibrary-category-option-help {
	grid-area: help;
	font-size: 0.82em;
	opacity: 0.7;
	line-height: 1.35;
}

.starlibrary-scan-prompt { margin-bottom: 0.75rem; }

/* Listings */

.starlibrary-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
	gap: 1.5rem;
}

.starlibrary-card {
	border: 1px solid rgba(0,0,0,0.12);
	border-radius: 0.4rem;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.starlibrary-card-image img { width: 100%; height: auto; display: block; }

.starlibrary-card-body { padding: 1rem; }

.starlibrary-card-title { margin: 0 0 0.5rem; font-size: 1.1em; }

.starlibrary-card-extract { margin: 0 0 0.75rem; }

.starlibrary-card-meta,
.starlibrary-card-categories { margin: 0; font-size: 0.85em; opacity: 0.75; }

.starlibrary-card-meta .starlibrary-when { margin-right: 0.75rem; }

/* One memory */

.starlibrary-memory-images {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.starlibrary-memory-image { margin: 0; }

.starlibrary-memory-image img { width: 100%; height: auto; border-radius: 0.3rem; }

.starlibrary-memory-image figcaption { font-size: 0.85em; opacity: 0.7; margin-top: 0.35rem; }

.starlibrary-memory-text { font-size: 1.05em; line-height: 1.65; }

.starlibrary-star-power {
	margin: 1.5rem 0;
	padding: 1rem 1.25rem;
	border-left: 3px solid rgba(0,0,0,0.2);
}

.starlibrary-star-power-label {
	display: block;
	font-size: 0.8em;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.7;
}

.starlibrary-memory-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid rgba(0,0,0,0.12); }

.starlibrary-memory-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; }

.starlibrary-memory-meta dt { font-weight: bold; opacity: 0.7; }

.starlibrary-memory-meta dd { margin: 0; }

.starlibrary-memory-actions { display: flex; gap: 1.5rem; margin-top: 1.5rem; }

/* Paging and filters */

.starlibrary-paging { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 2rem 0; }

.starlibrary-language-filter { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-bottom: 1.5rem; font-size: 0.9em; }

.starlibrary-language-filter-label { opacity: 0.7; }

.starlibrary-language-filter .is-selected { font-weight: bold; text-decoration: none; }

/* Forms */

.starlibrary form label { display: block; margin-top: 1rem; font-weight: bold; }

.starlibrary form input[type="text"],
.starlibrary form input[type="search"],
.starlibrary form input[type="url"],
.starlibrary form textarea,
.starlibrary form select { width: 100%; max-width: 40rem; }

.starlibrary form input[type="number"] { width: 8rem; }

.starlibrary-checkbox,
.starlibrary-radio { font-weight: normal; display: block; margin-top: 0.5rem; }

.starlibrary-field-help { font-size: 0.85em; opacity: 0.75; margin: 0.25rem 0 0; font-weight: normal; }

.starlibrary-optional { font-weight: normal; opacity: 0.6; font-size: 0.85em; }

.starlibrary-errors { color: #a3202b; margin: 1rem 0; padding-left: 1.25rem; }

.starlibrary-draft-status { margin-top: 1rem; min-height: 1.4em; }

.starlibrary-draft-status.is-error { color: #a3202b; }

.starlibrary-draft-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.5rem; }

/* The uploader */

.starlibrary-uploader { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(0,0,0,0.12); }

.starlibrary-uploader-guidance { font-size: 0.9em; opacity: 0.8; }

.starlibrary-uploader-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
	gap: 1rem;
	margin: 1rem 0;
}

.starlibrary-uploader-item { margin: 0; padding: 0.75rem; border: 1px solid rgba(0,0,0,0.12); border-radius: 0.3rem; }

.starlibrary-uploader-item img { width: 100%; height: auto; border-radius: 0.2rem; }

.starlibrary-uploader-alt { font-size: 0.85em; font-weight: normal; }

.starlibrary-uploader-drop {
	padding: 2rem;
	border: 2px dashed rgba(0,0,0,0.25);
	border-radius: 0.4rem;
	text-align: center;
}

.starlibrary-uploader-drop.is-over { border-color: #3b7ddd; background: rgba(59,125,221,0.06); }

.starlibrary-uploader-choose { display: inline-block; font-weight: bold; cursor: pointer; }

.starlibrary-uploader-status { margin-top: 0.75rem; min-height: 1.4em; }

/* The submission gate */

.starlibrary-submit-preview { padding: 1.25rem; background: rgba(0,0,0,0.03); border-radius: 0.4rem; }

.starlibrary-scan { margin: 2rem 0; }

.starlibrary-scan-findings { list-style: none; padding: 0; }

.starlibrary-scan-findings li { padding: 0.4rem 0.6rem; border-left: 3px solid transparent; margin-bottom: 0.4rem; }

.starlibrary-finding-likely { border-left-color: #c0392b; background: rgba(192,57,43,0.06); }

.starlibrary-finding-possible { border-left-color: #d19a24; background: rgba(209,154,36,0.06); }

.starlibrary-scan-findings code { font-weight: bold; margin-right: 0.6rem; }

.starlibrary-licence { margin: 2rem 0; }

.starlibrary-licence-text {
	max-height: 22rem;
	overflow-y: auto;
	padding: 1rem;
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 0.3rem;
	font-size: 0.92em;
	line-height: 1.6;
}

.starlibrary-licence-machine { font-size: 0.9em; opacity: 0.8; font-style: italic; }

.starlibrary-declaration { margin: 1.5rem 0; font-weight: normal; }

.starlibrary-real-name { opacity: 0.7; }

/* The contributor's own list */

/*
 * The contributor's own Star Memories.
 *
 * Cards rather than a table. A table is for comparing rows against each other,
 * and nobody compares their own memories; and its five columns forced the
 * attribution control into a cell far too narrow for it.
 *
 * "Write a Star Memory" and "My settings" are page buttons now, set in
 * process(), so there is no toolbar here at all.
 */

.starlibrary-closed-notice {
	margin: 0 0 1.5rem;
	padding: 0.8rem 1rem;
	border-radius: 0.4rem;
	background: rgba(0,0,0,0.05);
	opacity: 0.85;
}

.starlibrary-status-counts {
	list-style: none;
	padding: 0;
	margin: 0 0 1.5rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.starlibrary-status-pill {
	display: inline-block;
	padding: 0.2rem 0.7rem;
	border-radius: 1rem;
	font-size: 0.8em;
	font-weight: bold;
	white-space: nowrap;
	background: rgba(0,0,0,0.07);
	color: #333;
}

.starlibrary-status-pill.is-published { background: #2e8b57; color: #fff; }
.starlibrary-status-pill.is-pending   { background: #d99b1c; color: #241a05; }
.starlibrary-status-pill.is-draft     { background: rgba(0,0,0,0.1); color: #333; }
.starlibrary-status-pill.is-rejected  { background: #a3202b; color: #fff; }
.starlibrary-status-pill.is-withdrawn { background: rgba(0,0,0,0.5); color: #fff; }

.starlibrary-my-cards { display: flex; flex-direction: column; gap: 1.25rem; }

.starlibrary-my-card {
	padding: 1.5rem 1.75rem;
	border: 1px solid rgba(0,0,0,0.12);
	border-left: 4px solid rgba(0,0,0,0.12);
	border-radius: 0.5rem;
	background: #fff;
	box-shadow: 0 1px 3px rgba(15,23,42,.06);
}

/* The status at a glance, before anything has been read */
.starlibrary-my-card.starlibrary-status-published { border-left-color: #2e8b57; }
.starlibrary-my-card.starlibrary-status-pending   { border-left-color: #d99b1c; }
.starlibrary-my-card.starlibrary-status-rejected  { border-left-color: #a3202b; }

.starlibrary-my-card-header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	padding-bottom: 0.9rem;
	border-bottom: 1px solid rgba(0,0,0,0.08);
}

/*
 * The title is a plain heading, whatever the site does to h3 elsewhere.
 *
 * The channel stylesheet paints a full width highlight bar behind an h3, which
 * is right for a heading in an article and wrong inside a card, where it
 * swallowed the whole top of the card. Everything the bar depends on is
 * stated here rather than relied upon.
 */
.starlibrary .starlibrary-my-card-title {
	margin: 0;
	padding: 0;
	font-size: 1.15em;
	line-height: 1.3;
	text-align: left;
	background: none;
	border: 0;
	color: inherit;
}

.starlibrary-my-card-body {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem 1.5rem;
	padding-top: 1rem;
}

.starlibrary-my-card-detail { flex: 1 1 20rem; min-width: 0; }

.starlibrary-my-card-meta { margin: 0; font-size: 0.85em; opacity: 0.7; }

.starlibrary-my-card-credit { margin: 0.9rem 0 0; font-size: 0.9em; opacity: 0.85; }

.starlibrary-rejection {
	font-size: 0.85em;
	margin: 0.9rem 0 0;
	padding: 0.6rem 0.8rem;
	border-radius: 0.3rem;
	background: rgba(163,32,43,0.08);
}

.starlibrary-attribution-form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin-top: 0.9rem;
}

.starlibrary .starlibrary-attribution-form label {
	margin: 0;
	font-size: 0.85em;
	font-weight: bold;
	opacity: 0.75;
}

.starlibrary .starlibrary-attribution-form select,
.starlibrary .starlibrary-attribution-form input[type="text"] { width: auto; min-width: 11rem; margin: 0; }

/* Says what just happened, and holds its room so nothing shifts when it does */
.starlibrary-credit-state {
	font-size: 0.85em;
	min-height: 1.2em;
	color: #2e8b57;
	transition: opacity 0.2s;
}

.starlibrary-credit-state.is-error { color: #a3202b; font-weight: bold; }

/* Stacked and right aligned, so the same action is in the same place on every card */
.starlibrary-my-actions {
	flex: 0 0 12rem;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	margin-left: auto;
}

.starlibrary-my-actions .dc-button { width: 100%; box-sizing: border-box; }

.starlibrary .starlibrary-danger { color: #a3202b; }

/* Admin */

.starlibrary-admin-tabs { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid rgba(0,0,0,0.15); }

.starlibrary-admin-tabs .is-current { font-weight: bold; text-decoration: none; }

.starlibrary-admin-message { padding: 0.75rem 1rem; background: rgba(46,139,87,0.1); border-radius: 0.3rem; }

.starlibrary-admin-error { padding: 0.75rem 1rem; background: rgba(192,57,43,0.1); border-radius: 0.3rem; color: #a3202b; }

.starlibrary-admin-queue-item,
.starlibrary-admin-report,
.starlibrary-admin-category,
.starlibrary-admin-licence { padding: 1.25rem; margin-bottom: 1.5rem; border: 1px solid rgba(0,0,0,0.15); border-radius: 0.4rem; }

.starlibrary-admin-meta { font-size: 0.85em; opacity: 0.75; }

.starlibrary-admin-findings { list-style: none; padding: 0; font-size: 0.9em; }

.starlibrary-admin-images { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }

.starlibrary-admin-images figure { margin: 0; max-width: 12rem; }

.starlibrary-admin-images img { width: 100%; height: auto; }

.starlibrary-admin-table { width: 100%; border-collapse: collapse; }

.starlibrary-admin-table th,
.starlibrary-admin-table td { text-align: left; padding: 0.5rem; border-bottom: 1px solid rgba(0,0,0,0.1); vertical-align: top; }

.starlibrary-admin-inline-form { display: inline-flex; gap: 0.4rem; align-items: center; }

.starlibrary-admin-licence.is-current { border-color: #2e8b57; }

.starlibrary-badge { font-size: 0.75em; padding: 0.15rem 0.5rem; border-radius: 1rem; background: #2e8b57; color: #fff; vertical-align: middle; }

.starlibrary-admin-category.is-disabled { opacity: 0.6; }

@media (max-width: 40rem){

	.starlibrary-list { grid-template-columns: 1fr; }

	.starlibrary-memory-meta { grid-template-columns: 1fr; }

	.starlibrary-aside { flex-basis: 100%; margin-left: 0; }

	.starlibrary-my-card { padding: 1.1rem 1.25rem; }

	.starlibrary-my-actions { flex-basis: 100%; margin-left: 0; }

	.starlibrary .starlibrary-attribution-form select,
	.starlibrary .starlibrary-attribution-form input[type="text"] { width: 100%; min-width: 0; }
}
