/*
 * TerraEarth Gallery: the gallery pages inside the board style "terraearth".
 * Dark stone, maroon bars, gold links and the TerraEarth pixel heading font,
 * laid out as a modern gallery (album cards, justified picture rows, lightbox).
 * Everything is scoped to .te-gallery (the gallery page body) or uses the
 * teg- prefix (the lightbox, which is added to <body>), so the board and the
 * other extensions are not touched. This file is only loaded on gallery pages.
 *
 * Images in images/ come from the Coppermine theme "TerraEarth_Gallery" and
 * Coppermine 1.4 (GPL). fonts/lunchds-webfont.woff is the "Lunchtime Doubly So"
 * web font bundled with the TerraEarth site theme (also in terraearth/site).
 */

@font-face {
	font-family: 'TEGLunchtime';
	src: url('fonts/lunchds-webfont.woff') format('woff');
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

/* The board header shows the gallery scroll on gallery pages, like the old gallery. */
body.te-gallery-page .te-headerbar .site_logo {
	background-image: url("./images/gallerylogo.png");
}

.te-gallery, .teg-lb {
	--teg-gold: #FFFE66;
	--teg-gold-hi: #FFFF00;
	--teg-gold-deep: #E0C23A;
	--teg-maroon: #3A0808;
	--teg-maroon-2: #5A1010;
	--teg-maroon-3: #6B0C0C;
	--teg-ink: #F4EFE6;
	--teg-muted: #CDC3B6;
	--teg-panel: rgba(18, 12, 12, 0.86);
	--teg-panel-2: rgba(0, 0, 0, 0.38);
	--teg-edge: #000000;
	--teg-line: rgba(255, 254, 102, 0.22);
	--teg-radius: 8px;
	--teg-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
	--teg-head: 'TEGLunchtime', Verdana, Geneva, sans-serif;
}

.te-gallery {
	font-family: Verdana, Geneva, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--teg-ink);
	margin: 0 0 16px 0;
}
.te-gallery *, .te-gallery *::before, .te-gallery *::after,
.teg-lb, .teg-lb *, .teg-lb *::before, .teg-lb *::after { box-sizing: border-box; }

.te-gallery p { color: inherit; margin: 0 0 8px 0; }
.te-gallery a { color: var(--teg-gold); text-decoration: none; }
.te-gallery a:hover { color: var(--teg-gold-hi); text-decoration: underline; }
.te-gallery a:focus-visible, .te-gallery button:focus-visible, .te-gallery input:focus-visible,
.te-gallery select:focus-visible, .te-gallery textarea:focus-visible, .teg-lb a:focus-visible, .teg-lb button:focus-visible {
	outline: 2px solid var(--teg-gold);
	outline-offset: 2px;
}
.te-gallery ul, .te-gallery ol { list-style: none; margin: 0; padding: 0; }
.te-gallery img { border: 0; }

.teg-visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.te-gallery .teg-muted { color: var(--teg-muted); }
.te-gallery .teg-small { font-size: 12px; }

/* ------------------------------------------------------------------
   Headings (TerraEarth pixel font)
   ------------------------------------------------------------------ */
.te-gallery h1.teg-heading, .te-gallery h2.teg-heading, .te-gallery .teg-heading {
	font-family: var(--teg-head);
	font-weight: normal;
	font-size: 22px;
	line-height: 1.2;
	letter-spacing: 0.02em;
	color: var(--teg-gold);
	text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
	margin: 0;
	padding: 0;
	border: 0;
	text-transform: none;
}
.te-gallery .teg-heading a { color: var(--teg-gold); }
.te-gallery .teg-heading a:hover { color: var(--teg-gold-hi); text-decoration: none; }
.te-gallery h1.teg-heading-big { font-size: 30px; }

/* ------------------------------------------------------------------
   Gallery menu (the breadcrumb is the board's)
   ------------------------------------------------------------------ */
.te-gallery .teg-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 16px;
	padding: 5px;
	margin: 0 0 14px 0;
	background: var(--teg-maroon) url("./images/bg2.gif");
	border: 1px solid var(--teg-edge);
	border-radius: var(--teg-radius);
	box-shadow: var(--teg-shadow);
}
.te-gallery .teg-nav ul { display: flex; flex-wrap: wrap; gap: 2px; }
.te-gallery .teg-nav a {
	display: block;
	padding: 7px 12px;
	border-radius: 6px;
	color: var(--teg-gold);
	font-weight: bold;
	font-size: 13px;
	white-space: nowrap;
}
.te-gallery .teg-nav a:hover { background: rgba(0, 0, 0, 0.35); color: var(--teg-gold-hi); text-decoration: none; }
.te-gallery .teg-nav a[aria-current] {
	background: var(--teg-maroon-3);
	color: #FFFFFF;
	box-shadow: inset 0 -2px 0 var(--teg-gold);
}
.te-gallery .teg-nav .teg-nav-user a { font-weight: normal; }
.te-gallery .teg-nav .teg-nav-user:not(:has(li)) { display: none; }
.te-gallery .teg-nav a.teg-nav-upload {
	background: linear-gradient(#FFFE66, var(--teg-gold-deep));
	color: #2A0505;
	font-weight: bold;
}
.te-gallery .teg-nav a.teg-nav-upload:hover { filter: brightness(1.08); color: #2A0505; }
.te-gallery .teg-queue-count {
	display: inline-block;
	min-width: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: #AA0000;
	color: #FFFFFF;
	font-size: 11px;
	text-align: center;
}


/* ------------------------------------------------------------------
   Page head, sections
   ------------------------------------------------------------------ */
.te-gallery .teg-pagehead { margin: 4px 0 16px 0; }
.te-gallery .teg-pagehead-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.te-gallery .teg-pagehead-desc { color: var(--teg-muted); margin-top: 6px; max-width: 70ch; }
.te-gallery .teg-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }

.te-gallery .teg-section { margin: 0 0 28px 0; }
.te-gallery .teg-section-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 6px 0;
}
.te-gallery .teg-section-head::after {
	content: "";
	flex: 1 1 auto;
	order: 1;
	height: 2px;
	background: linear-gradient(90deg, var(--teg-maroon-3), rgba(107, 12, 12, 0));
}
.te-gallery .teg-section-count {
	order: 2;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
	color: var(--teg-muted);
	white-space: nowrap;
	text-shadow: none;
}
.te-gallery .teg-heading .teg-section-count { margin-left: 8px; }
.te-gallery .teg-section-desc { color: var(--teg-muted); font-size: 13px; margin: 0 0 12px 0; }

.te-gallery .teg-subcat {
	margin: 0 0 10px 0;
	padding: 8px 12px;
	background: var(--teg-panel);
	border-left: 3px solid var(--teg-maroon-3);
	border-radius: 0 var(--teg-radius) var(--teg-radius) 0;
}
.te-gallery .teg-subcat-link { font-weight: bold; margin-right: 8px; }

.te-gallery .teg-stats {
	margin: 0 0 28px 0;
	padding: 10px 14px;
	text-align: center;
	font-size: 13px;
	color: var(--teg-ink);
	background: var(--teg-maroon) url("./images/bg2.gif");
	border: 1px solid var(--teg-edge);
	border-radius: var(--teg-radius);
}
.te-gallery .teg-stats b { color: var(--teg-gold); }

.te-gallery .teg-empty {
	padding: 28px 16px;
	text-align: center;
	color: var(--teg-muted);
	background: var(--teg-panel);
	border: 1px dashed #4A3030;
	border-radius: var(--teg-radius);
}

/* ------------------------------------------------------------------
   Album cards
   ------------------------------------------------------------------ */
.te-gallery .teg-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 16px;
	margin: 0 0 8px 0;
}
.te-gallery .teg-card {
	display: flex;
	flex-direction: column;
	background: var(--teg-panel);
	border: 1px solid var(--teg-edge);
	border-radius: var(--teg-radius);
	overflow: hidden;
	box-shadow: var(--teg-shadow);
	transition: transform 0.18s ease, border-color 0.18s ease;
}
.te-gallery .teg-card:hover, .te-gallery .teg-card:focus-within { transform: translateY(-2px); border-color: var(--teg-maroon-3); }
.te-gallery .teg-card-link { display: block; color: inherit; }
.te-gallery .teg-card-link:hover { text-decoration: none; }
.te-gallery .teg-card-link:focus-visible { outline-offset: -2px; }
.te-gallery .teg-card-cover {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #0B0707 url("./images/bg2.gif");
	border-bottom: 2px solid var(--teg-maroon-3);
}
.te-gallery .teg-card-cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}
.te-gallery .teg-card-cover img.teg-card-nopic { object-fit: contain; padding: 18%; opacity: 0.8; }
.te-gallery .teg-card:hover .teg-card-cover img { transform: scale(1.04); }
.te-gallery .teg-card-title {
	display: block;
	padding: 10px 14px 0 14px;
	font-size: 15px;
	font-weight: bold;
	color: var(--teg-gold);
}
.te-gallery .teg-card-link:hover .teg-card-title { color: var(--teg-gold-hi); text-decoration: underline; }
.te-gallery .teg-card-body { padding: 4px 14px 12px 14px; font-size: 13px; flex: 1 1 auto; display: flex; flex-direction: column; }
.te-gallery .teg-card-desc {
	color: var(--teg-ink);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
	margin-bottom: 6px;
}
.te-gallery .teg-card-owner { font-size: 12px; margin: 0 0 2px 0; color: var(--teg-muted); }
.te-gallery .teg-card-stat { font-size: 12px; margin: auto 0 0 0; color: var(--teg-muted); }

/* ------------------------------------------------------------------
   Picture tiles (shared): hover overlay with title / views / rating
   ------------------------------------------------------------------ */
.te-gallery .teg-tile-link {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 6px;
	background: #0B0707;
	border: 1px solid var(--teg-edge);
	color: var(--teg-ink);
}
.te-gallery .teg-tile-link:hover { text-decoration: none; }
.te-gallery .teg-tile-link img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease, filter 0.35s ease;
}
.te-gallery .teg-tile-link:hover img, .te-gallery .teg-tile-link:focus-visible img { transform: scale(1.05); filter: brightness(1.08); }
.te-gallery .teg-over {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	padding: 28px 10px 8px 10px;
	background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.88));
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
	text-align: left;
}
.te-gallery .teg-tile-link:hover .teg-over, .te-gallery .teg-tile-link:focus-visible .teg-over { opacity: 1; transform: none; }
.te-gallery .teg-over-title {
	display: block;
	font-size: 13px;
	font-weight: bold;
	color: var(--teg-gold);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-shadow: 1px 1px 0 #000;
}
.te-gallery .teg-over-meta { display: block; font-size: 11px; color: #EEE8DD; }
.te-gallery .teg-star::before { content: "\2605"; color: var(--teg-gold); margin-right: 2px; }
.te-gallery .teg-badge {
	position: absolute;
	top: 6px; left: 6px;
	padding: 2px 7px;
	border-radius: 4px;
	background: #AA0000;
	color: #FFFFFF;
	font-size: 11px;
	font-weight: bold;
}
.te-gallery .teg-badge-inline { position: static; display: inline-block; margin: 4px 0; }

/* Main page strips: one row of square tiles, sideways scrolling on small screens */
.te-gallery .teg-strip {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(130px, 1fr);
	gap: 10px;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	padding: 4px 0 8px 0;
	scrollbar-color: var(--teg-maroon-3) transparent;
}
.te-gallery .teg-tile { scroll-snap-align: start; }
.te-gallery .teg-strip .teg-tile-link { aspect-ratio: 1 / 1; }

/* Album: justified rows. Each tile's width grows with its aspect ratio --r,
   so every picture in a row gets the same height and is not cropped. */
.te-gallery .teg-jgrid {
	--teg-rowh: 210px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 16px 0;
}
.te-gallery .teg-jtile {
	flex-grow: calc(var(--r) * 100);
	flex-shrink: 1;
	flex-basis: calc(var(--r) * var(--teg-rowh));
	max-width: calc(var(--r) * var(--teg-rowh) * 2);
}
.te-gallery .teg-jtile .teg-tile-link { aspect-ratio: var(--r); height: auto; }
.te-gallery .teg-jfill { flex: 10000 1 0px; height: 0; }

/* Meta lists: picture cards with details */
.te-gallery .teg-pcards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 16px;
	margin: 0 0 16px 0;
}
.te-gallery .teg-pcards-wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.te-gallery .teg-pcard {
	display: flex;
	flex-direction: column;
	background: var(--teg-panel);
	border: 1px solid var(--teg-edge);
	border-radius: var(--teg-radius);
	overflow: hidden;
	box-shadow: var(--teg-shadow);
}
.te-gallery .teg-pcard .teg-pcard-pic { aspect-ratio: 4 / 3; border: 0; border-radius: 0; border-bottom: 2px solid var(--teg-maroon-3); }
.te-gallery .teg-pcard-body { padding: 8px 12px 12px 12px; font-size: 12px; }
.te-gallery .teg-pcard-title { display: block; font-size: 14px; font-weight: bold; margin-bottom: 2px; }
.te-gallery .teg-pcard-meta { display: block; color: var(--teg-muted); }
.te-gallery .teg-pcard-meta img { vertical-align: middle; }
.te-gallery .teg-pcard-caption, .te-gallery .teg-pcard-comment { margin-top: 6px; color: var(--teg-ink); overflow-wrap: anywhere; }
.te-gallery .teg-pcard-caption a, .te-gallery .teg-pcard-comment a { text-decoration: underline; }
.te-gallery .teg-pcard-comment { padding: 6px 8px; background: var(--teg-panel-2); border-left: 3px solid var(--teg-maroon-3); border-radius: 0 4px 4px 0; }
.te-gallery .teg-check { display: block; padding: 0 12px 10px 12px; font-size: 13px; }

/* ------------------------------------------------------------------
   Buttons, sort, pages
   ------------------------------------------------------------------ */
.te-gallery .teg-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 13px;
	border: 1px solid var(--teg-edge);
	border-radius: 6px;
	background: var(--teg-maroon-2) url("./images/bg2.gif");
	color: var(--teg-gold);
	font: bold 13px/1.2 Verdana, Geneva, sans-serif;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}
.te-gallery .teg-btn:hover { background: var(--teg-maroon-3); color: var(--teg-gold-hi); text-decoration: none; }
.te-gallery .teg-btn-gold, .te-gallery input.teg-btn-gold {
	background: linear-gradient(#FFFE66, var(--teg-gold-deep));
	color: #2A0505;
}
.te-gallery .teg-btn-gold:hover, .te-gallery input.teg-btn-gold:hover { background: linear-gradient(#FFFF99, #F0D24A); color: #2A0505; }
.te-gallery .teg-btn.is-on { background: var(--teg-maroon-3); box-shadow: inset 0 0 0 1px var(--teg-gold); }
.te-gallery .teg-btn.is-disabled { opacity: 0.4; cursor: default; }
.te-gallery .teg-linkbutton {
	background: none;
	border: 0;
	padding: 0;
	color: var(--teg-gold);
	cursor: pointer;
	font: inherit;
}
.te-gallery .teg-linkbutton:hover { color: var(--teg-gold-hi); text-decoration: underline; }
.te-gallery .teg-inline { display: inline; }
.te-gallery .teg-actions { margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Small icons drawn in CSS (no icon font, no requests) */
.te-gallery .teg-ico { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; position: relative; }
.te-gallery .teg-ico-prev, .te-gallery .teg-ico-next { width: 8px; height: 8px; border: solid currentColor; border-width: 0 0 2px 2px; }
.te-gallery .teg-ico-prev { transform: rotate(45deg); margin-left: 3px; }
.te-gallery .teg-ico-next { transform: rotate(-135deg); margin-right: 3px; }
.te-gallery .teg-ico-play { width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 9px; border-color: transparent transparent transparent currentColor; }
.te-gallery .teg-ico-grid {
	background:
		linear-gradient(currentColor, currentColor) 0 0 / 4px 4px no-repeat,
		linear-gradient(currentColor, currentColor) 6px 0 / 4px 4px no-repeat,
		linear-gradient(currentColor, currentColor) 0 6px / 4px 4px no-repeat,
		linear-gradient(currentColor, currentColor) 6px 6px / 4px 4px no-repeat;
}
.te-gallery .teg-ico-info { width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 50%; }
.te-gallery .teg-ico-info::before { content: "i"; position: absolute; inset: 0; font: bold 9px/10px Verdana, sans-serif; text-align: center; }
.te-gallery .teg-ico-mail { width: 14px; height: 10px; border: 2px solid currentColor; border-radius: 2px; }
.te-gallery .teg-ico-mail::before { content: ""; position: absolute; left: 1px; top: -3px; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.te-gallery .teg-ico-heart::before { content: "\2665"; font-size: 14px; line-height: 10px; }

.te-gallery .teg-sort { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--teg-muted); }
.te-gallery .teg-sort li { display: inline-flex; align-items: center; gap: 3px; }
.te-gallery .teg-sort-name { margin-right: 3px; }
.te-gallery .teg-sort-dir {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 4px;
	background: var(--teg-panel-2);
	border: 1px solid #3A2A2A;
	color: var(--teg-gold);
	font-size: 10px;
}
.te-gallery .teg-sort-dir:hover { border-color: var(--teg-gold); text-decoration: none; }
.te-gallery .teg-asc::before { content: "\25B2"; }
.te-gallery .teg-desc::before { content: "\25BC"; }
.te-gallery .teg-sort-dir.is-on { background: var(--teg-gold); color: #2A0505; border-color: var(--teg-gold); }

.te-gallery .teg-pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	margin: 8px 0 16px 0;
	font-size: 13px;
}
.te-gallery .teg-pages { display: flex; flex-wrap: wrap; gap: 4px; }
.te-gallery .teg-page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 34px;
	padding: 0 8px;
	border-radius: 6px;
	background: var(--teg-maroon-2) url("./images/bg2.gif");
	border: 1px solid var(--teg-edge);
	font-weight: bold;
}
.te-gallery a.teg-page:hover { background: var(--teg-maroon-3); text-decoration: none; }
.te-gallery .teg-page.is-current { background: var(--teg-gold); color: #2A0505; }

/* ------------------------------------------------------------------
   Picture page
   ------------------------------------------------------------------ */
.te-gallery .teg-picnav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px 0; }
.te-gallery .teg-picnav-pos {
	flex: 1 1 auto;
	text-align: center;
	font-family: var(--teg-head);
	color: var(--teg-gold);
	text-shadow: 1px 1px 0 #000;
	letter-spacing: 0.05em;
}
.te-gallery .teg-picwrap {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 16px;
	align-items: start;
	margin: 0 0 16px 0;
}
.te-gallery .teg-stage {
	margin: 0;
	background: radial-gradient(ellipse at center, #2A1414 0%, #0A0606 75%);
	border: 1px solid var(--teg-edge);
	border-radius: var(--teg-radius);
	box-shadow: var(--teg-shadow);
	overflow: hidden;
}
.te-gallery .teg-stage-img {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 240px;
	padding: 20px;
}
.te-gallery .teg-stage-img a { display: block; line-height: 0; cursor: zoom-in; }
.te-gallery .teg-stage-img img {
	display: block;
	max-width: 100%;
	max-height: 78vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border: 1px solid #000;
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.7);
}
.te-gallery .teg-stage-img a.teg-download { line-height: 1.4; text-align: center; cursor: pointer; }
.te-gallery .teg-stage-img a.teg-download img { margin: 0 auto 8px auto; }
.te-gallery .teg-stage-cap {
	padding: 12px 18px 16px 18px;
	background: rgba(0, 0, 0, 0.45);
	border-top: 2px solid var(--teg-maroon-3);
}
.te-gallery h1.teg-pic-title, .te-gallery .teg-pic-title { font-family: var(--teg-head); font-size: 24px; color: var(--teg-gold); text-shadow: 2px 2px 0 #000; }
.te-gallery .teg-pic-caption { margin-top: 6px; color: var(--teg-ink); overflow-wrap: anywhere; }
.te-gallery .teg-pic-caption a { text-decoration: underline; }

.te-gallery .teg-panel {
	background: var(--teg-panel);
	border: 1px solid var(--teg-edge);
	border-radius: var(--teg-radius);
	box-shadow: var(--teg-shadow);
	padding: 14px 16px;
	margin: 0 0 14px 0;
}
.te-gallery .teg-side .teg-panel:last-child { margin-bottom: 0; }
.te-gallery h2.teg-panel-title, .te-gallery .teg-panel-title {
	display: block;
	margin: 0 0 10px 0;
	padding: 0;
	border: 0;
	font: bold 12px/1.3 Verdana, Geneva, sans-serif;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--teg-muted);
}
.te-gallery .teg-rate-now { font-size: 12px; color: var(--teg-muted); }
.te-gallery .teg-rate-now img { vertical-align: middle; }
.te-gallery .teg-rate-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.te-gallery .teg-rate-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 7px 2px;
	background: var(--teg-panel-2);
	border: 1px solid #3A2A2A;
	border-radius: 6px;
	color: var(--teg-ink);
	font: 11px Verdana, Geneva, sans-serif;
	cursor: pointer;
}
.te-gallery .teg-rate-btn:hover { border-color: var(--teg-gold); color: var(--teg-gold); }
.te-gallery .teg-actions-panel > * { margin: 0 0 8px 0; }
.te-gallery .teg-actions-panel > *:last-child { margin-bottom: 0; }

.te-gallery .teg-info { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; }
.te-gallery .teg-info dt { color: var(--teg-muted); font-weight: normal; }
.te-gallery .teg-info dd { margin: 0; overflow-wrap: anywhere; }
.te-gallery .teg-info img { vertical-align: middle; }
.te-gallery .teg-keywords a { display: inline-block; margin: 0 4px 4px 0; padding: 1px 8px; border-radius: 10px; background: var(--teg-panel-2); border: 1px solid #3A2A2A; font-size: 12px; }
.te-gallery .teg-url { font-size: 12px; }

/* Film strip: the old gallery's sprocket tile above and below */
.te-gallery .teg-film {
	margin: 0 0 20px 0;
	padding: 20px 10px;
	background: url("./images/tile.gif") repeat-x 0 -6px, url("./images/tile.gif") repeat-x 0 calc(100% + 6px), #000;
	border-radius: var(--teg-radius);
	overflow-x: auto;
}
.te-gallery .teg-film ul { display: flex; gap: 10px; justify-content: center; min-width: min-content; }
.te-gallery .teg-film a { display: block; line-height: 0; border: 2px solid transparent; border-radius: 4px; opacity: 0.75; transition: opacity 0.2s ease; }
.te-gallery .teg-film a:hover, .te-gallery .teg-film a:focus-visible { opacity: 1; }
.te-gallery .teg-film a.is-current { border-color: var(--teg-gold); opacity: 1; }
.te-gallery .teg-film img { display: block; height: 84px; width: auto; max-width: none; border-radius: 2px; }

/* Comments */
.te-gallery .teg-comments { max-width: 900px; }
.te-gallery .teg-comments > .teg-heading { margin: 0 0 12px 0; }
.te-gallery .teg-comment {
	margin: 0 0 10px 0;
	padding: 10px 14px;
	background: var(--teg-panel);
	border: 1px solid var(--teg-edge);
	border-left: 3px solid var(--teg-maroon-3);
	border-radius: 0 var(--teg-radius) var(--teg-radius) 0;
	scroll-margin-top: 60px;
}
.te-gallery .teg-comment:target { border-left-color: var(--teg-gold); }
.te-gallery .teg-comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 4px; }
.te-gallery .comment_date { color: #A89D90; font-size: 12px; }
.te-gallery .teg-comment-actions { margin-left: auto; font-size: 12px; display: inline-flex; gap: 10px; }
.te-gallery .teg-comment-actions form { display: inline; }
.te-gallery .postbody-text { overflow-wrap: anywhere; }
.te-gallery .teg-comment-form textarea { width: 100%; }
.te-gallery .teg-smilies { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 2px; }
.te-gallery .teg-smilies a { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; border-radius: 4px; }
.te-gallery .teg-smilies a:hover { background: var(--teg-panel-2); }

/* Slideshow */
.te-gallery .teg-slide .teg-stage-img { min-height: 60vh; }
.te-gallery .teg-slide .teg-stage-cap { text-align: center; }

/* ------------------------------------------------------------------
   Forms (upload, edit, e-card, my albums, search)
   ------------------------------------------------------------------ */
.te-gallery .teg-formpage { max-width: 760px; margin: 0 auto; }
.te-gallery .teg-field { margin: 0 0 14px 0; }
.te-gallery .teg-field > label { display: block; margin: 0 0 5px 0; font-weight: bold; font-size: 13px; color: var(--teg-ink); }
.te-gallery .teg-input, .te-gallery .teg-search input[type="search"] {
	display: block;
	width: 100%;
	padding: 9px 11px;
	background: #120C0C;
	color: var(--teg-ink);
	border: 1px solid #5A3A3A;
	border-radius: 6px;
	font: 14px/1.4 Verdana, Geneva, sans-serif;
}
.te-gallery textarea.teg-input { resize: vertical; min-height: 90px; }
.te-gallery .teg-input:focus { border-color: var(--teg-gold); outline: 2px solid rgba(255, 254, 102, 0.35); outline-offset: 0; }
.te-gallery select.teg-input option { background: #120C0C; color: var(--teg-ink); }
.te-gallery .teg-file { padding: 6px; }
.te-gallery .teg-file::file-selector-button {
	margin-right: 10px;
	padding: 6px 12px;
	border: 1px solid #000;
	border-radius: 5px;
	background: var(--teg-maroon-3);
	color: var(--teg-gold);
	font: bold 13px Verdana, Geneva, sans-serif;
	cursor: pointer;
}
.te-gallery .teg-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 4px; }
.te-gallery .teg-form-pic { text-align: center; }
.te-gallery .teg-form-pic img { max-width: 100%; height: auto; border: 1px solid #000; border-radius: 4px; }
.te-gallery .teg-danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid #4A2A2A; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; }
.te-gallery .teg-note { font-size: 12px; color: var(--teg-muted); margin: 4px 0 12px 0; }
.te-gallery .teg-error {
	margin: 0 0 14px 0;
	padding: 10px 14px;
	background: rgba(170, 0, 0, 0.25);
	border: 1px solid #AA0000;
	border-radius: var(--teg-radius);
	color: #FFD6D6;
	font-weight: bold;
}
.te-gallery .teg-error-text { color: #FFB0B0; font-weight: bold; }
.te-gallery .teg-mylist li { padding: 8px 0; border-bottom: 1px solid #3A2A2A; }
.te-gallery .teg-mylist li:last-child { border-bottom: 0; }
.te-gallery .teg-search { max-width: 760px; }
.te-gallery .teg-search > label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--teg-muted); }
.te-gallery .teg-search-row { display: flex; gap: 8px; }
.te-gallery .teg-search-row input[type="search"] { flex: 1 1 auto; min-width: 0; }
.te-gallery .teg-search-site { margin: 10px 0 0 0; font-size: 13px; }

/* ------------------------------------------------------------------
   Latest pictures outside the gallery: beside the forum list on the board
   index (wide screens), below it (narrow screens, one sideways row), and
   in the site front page's sidebar.
   ------------------------------------------------------------------ */
.te-gallery.teg-boardside {
	margin: 0;
	padding: 12px;
	background: var(--teg-panel);
	border: 1px solid var(--teg-edge);
	border-radius: var(--teg-radius);
	box-shadow: var(--teg-shadow);
	font-size: 12px;
}
.te-gallery.teg-boardside .teg-heading { font-size: 18px; }
.te-gallery .teg-boardside-sub { margin: 2px 0 8px 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teg-muted); }
.te-gallery .teg-boardside-grid + .teg-boardside-sub { margin-top: 12px; }
.te-gallery .teg-boardside-sub a { color: var(--teg-muted); }
.te-gallery .teg-boardside-sub a:hover { color: var(--teg-gold); }
.te-gallery .teg-boardside-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.te-gallery .teg-boardside-grid .teg-tile-link { aspect-ratio: 1 / 1; }
.te-gallery .teg-boardside-grid .teg-over { padding: 16px 6px 5px 6px; }
.te-gallery .teg-boardside-grid .teg-over-title { font-size: 11px; }
.te-gallery .teg-boardside-grid .teg-over-meta { font-size: 10px; }
.te-gallery .teg-boardside-stats { margin: 8px 0 0 0; color: var(--teg-muted); font-size: 11px; }
.te-gallery .teg-boardside-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0 0; }
.te-gallery .teg-boardside-links .teg-btn { padding: 6px 10px; font-size: 12px; }

/* Board index, wide: a column on the right; the forum list keeps to its left. */
.te-gallery.teg-boardside-wide { float: right; width: 250px; margin: 4px 0 12px 14px; }
.te-gallery.teg-boardside-narrow { display: none; clear: both; margin: 14px 0 4px 0; }
body.section-index .teg-boardside-wide ~ .action-bar.compact,
body.section-index .teg-boardside-wide ~ .te-forumlist { display: flow-root; clear: none; }
body.section-index .teg-boardside-wide ~ .headerspace,
body.section-index .teg-boardside-wide ~ .stat-block { clear: both; }

@media (max-width: 1000px) {
	.te-gallery.teg-boardside-wide { display: none; }
	body.section-index .teg-boardside-wide ~ .action-bar.compact,
	body.section-index .teg-boardside-wide ~ .te-forumlist { display: block; }
	.te-gallery.teg-boardside-narrow { display: block; }
	.te-gallery.teg-boardside-narrow .teg-boardside-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
	/* Phone: three across, every tile whole (no sideways row that looks cut off) */
	.te-gallery.teg-boardside-narrow .teg-boardside-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
	.te-gallery.teg-boardside-narrow .teg-over-meta { display: none; }
}

/* Site front page sidebar (170 px wide, old site layout) */
.te-gallery.teg-boardside-site { margin: 0 0 15px 0; padding: 8px; font-size: 11px; line-height: 1.4; }
.te-gallery.teg-boardside-site .teg-heading { font-size: 15px; }
.te-gallery.teg-boardside-site .teg-boardside-links .teg-btn { padding: 4px 7px; font-size: 11px; }
.te-site #sidebar .te-gallery.teg-boardside-site ul li { margin: 0; }
.te-site #sidebar .te-gallery.teg-boardside-site ul li:before { content: none; }

/* ------------------------------------------------------------------
   Lightbox (added to <body> by te_gallery.js)
   ------------------------------------------------------------------ */
html.teg-lb-lock, html.teg-lb-lock body { overflow: hidden; }
.teg-lb {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: none;
	flex-direction: column;
	background: rgba(8, 4, 4, 0.97);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	color: var(--teg-ink);
	font: 14px/1.4 Verdana, Geneva, sans-serif;
}
.teg-lb.is-open { display: flex; }
.teg-lb-stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px 64px 8px 64px;
	touch-action: pan-y pinch-zoom;
}
.teg-lb-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border: 1px solid #000;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
	transition: opacity 0.2s ease;
	user-select: none;
	-webkit-user-drag: none;
}
.teg-lb.is-loading .teg-lb-img { opacity: 0.25; }
.teg-lb-spin {
	position: absolute;
	top: 50%; left: 50%;
	width: 36px; height: 36px;
	margin: -18px 0 0 -18px;
	border: 3px solid rgba(255, 254, 102, 0.25);
	border-top-color: var(--teg-gold);
	border-radius: 50%;
	display: none;
	animation: teg-spin 0.8s linear infinite;
}
.teg-lb.is-loading .teg-lb-spin { display: block; }
@keyframes teg-spin { to { transform: rotate(360deg); } }
.teg-lb-btn {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 1px solid rgba(255, 254, 102, 0.45);
	border-radius: 50%;
	background: rgba(58, 8, 8, 0.85);
	color: var(--teg-gold);
	font: bold 24px/1 Verdana, Geneva, sans-serif;
	cursor: pointer;
}
.teg-lb-btn:hover { background: #6B0C0C; color: #FFFF00; border-color: var(--teg-gold); }
.teg-lb-btn[hidden] { display: none; }
.teg-lb-close { top: 12px; right: 12px; }
.teg-lb-prev { left: 10px; top: 50%; margin-top: -23px; }
.teg-lb-next { right: 10px; top: 50%; margin-top: -23px; }
.teg-lb-prev::before, .teg-lb-next::before { content: ""; width: 12px; height: 12px; border: solid currentColor; border-width: 0 0 3px 3px; }
.teg-lb-prev::before { transform: rotate(45deg); margin-left: 5px; }
.teg-lb-next::before { transform: rotate(-135deg); margin-right: 5px; }
.teg-lb-cap {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px 18px;
	padding: 10px 18px 14px 18px;
	background: var(--teg-maroon) url("./images/bg2.gif");
	border-top: 2px solid #000;
}
.teg-lb-title { font-family: var(--teg-head); font-weight: normal; font-size: 20px; color: var(--teg-gold); text-shadow: 2px 2px 0 #000; margin-right: 10px; }
.teg-lb-meta { font-size: 12px; color: var(--teg-muted); }
.teg-lb-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; }
.teg-lb-count { color: var(--teg-muted); font-size: 12px; }
.teg-lb-links a { color: var(--teg-gold); font-weight: bold; }
.teg-lb-links a:hover { color: #FFFF00; }
.teg-lb-links a[hidden] { display: none; }

/* ------------------------------------------------------------------
   Small screens
   ------------------------------------------------------------------ */
@media (max-width: 900px) {
	.te-gallery .teg-picwrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
	body.te-gallery-page .te-headerbar .site_logo {
		width: min(687px, calc(100vw - 32px));
		height: auto;
		aspect-ratio: 687 / 154;
		background-size: contain;
	}
	.te-gallery { font-size: 14px; }
	/* Phone: the menu wraps (nothing hidden off the edge) */
	.te-gallery .teg-nav { display: block; padding: 4px; }
	.te-gallery .teg-nav ul { justify-content: center; }
	.te-gallery .teg-nav .teg-nav-user { border-top: 1px solid rgba(0, 0, 0, 0.5); margin-top: 3px; padding-top: 3px; }
	.te-gallery .teg-nav a { padding: 7px 9px; font-size: 13px; }
	.te-gallery h1.teg-heading-big { font-size: 24px; }
	.te-gallery .teg-heading { font-size: 20px; }
	.te-gallery .teg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.te-gallery .teg-card-title { font-size: 13px; padding: 8px 10px 0 10px; }
	.te-gallery .teg-card-body { padding: 2px 10px 10px 10px; font-size: 12px; }
	.te-gallery .teg-card-desc { -webkit-line-clamp: 2; }
	.te-gallery .teg-pcards, .te-gallery .teg-pcards-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.te-gallery .teg-jgrid { --teg-rowh: 120px; gap: 5px; }
	/* Phone: strips as a 3 x 2 grid, every tile whole */
	.te-gallery .teg-strip { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-columns: auto; gap: 6px; overflow: visible; }
	.te-gallery .teg-strip .teg-tile:nth-child(n+7) { display: none; }
	.te-gallery .teg-strip .teg-over { padding: 14px 5px 4px 5px; }
	.te-gallery .teg-strip .teg-over-title { font-size: 11px; }
	.te-gallery .teg-strip .teg-over-meta { display: none; }
	.te-gallery .teg-picnav .teg-btn { padding: 7px 10px; }
	.te-gallery .teg-picnav-pos { order: -1; flex-basis: 100%; }
	.te-gallery .teg-stage-img { padding: 10px; min-height: 160px; }
	.te-gallery .teg-film img { height: 64px; }
	.teg-lb-stage { padding: 56px 6px 6px 6px; }
	.teg-lb-prev, .teg-lb-next { top: auto; bottom: 10px; margin-top: 0; width: 42px; height: 42px; }
	.teg-lb-title { font-size: 17px; }
}
@media (max-width: 420px) {
	.te-gallery .teg-pcards-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) {
	.te-gallery .teg-over { opacity: 1; transform: none; padding-top: 18px; }
	.te-gallery .teg-jgrid .teg-over-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.te-gallery *, .teg-lb * { transition: none !important; animation: none !important; }
}
