/* =========================================================
   THS Class Gallery — front-end styles
   Design: warm "yearbook shelf" — espresso + coral on cream.
   Rewritten to match the actual renderer markup (thscg-class-btn,
   thscg-expand, thscg-section-btn/dot/count, thscg-grid, thscg-lightbox…).

   Root cause of the old bug: .thscg-section-dot was being rendered
   as a fixed-size circle, so longer section names ("Apples",
   "Mulberry") got clipped. Here .thscg-section-dot is just the label
   text inside a flexible pill button — width follows content, never
   a fixed circle.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600;700&display=swap');

#thscg-root {
	--thscg-ink: #2b2018;
	--thscg-ink-soft: #4a392c;
	--thscg-coral: #e4693a;
	--thscg-coral-deep: #c4502a;
	--thscg-cream: #faf3e8;
	--thscg-cream-deep: #f1e4d3;
	--thscg-paper: #ffffff;
	--thscg-muted: #8a7566;
	--thscg-line: #e7d9c6;
	--thscg-radius-lg: 18px;
	--thscg-radius-md: 12px;
	--thscg-radius-sm: 8px;
	--thscg-shadow: 0 6px 20px rgba(43, 32, 24, 0.08);
	--thscg-shadow-hover: 0 10px 28px rgba(43, 32, 24, 0.14);

	display: block;
	font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var(--thscg-ink);
	background: var(--thscg-cream);
	border-radius: var(--thscg-radius-lg);
	padding: clamp(16px, 3vw, 32px);
	box-sizing: border-box;
}

#thscg-root *,
#thscg-root *::before,
#thscg-root *::after {
	box-sizing: border-box;
}

#thscg-root button {
	font-family: inherit;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background: none;
	border: 0;
	color: inherit;
}

#thscg-root img { max-width: 100%; display: block; }

/* ---------------------------------------------------------
   Class rows — 3 per row ("shelf" of plaques)
   --------------------------------------------------------- */
#thscg-root .thscg-group {
	margin: 0 0 12px;
}

#thscg-root .thscg-row {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

@media (max-width: 780px) {
	#thscg-root .thscg-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
	#thscg-root .thscg-row { grid-template-columns: 1fr; }
}

#thscg-root .thscg-class-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	min-height: 56px;
	padding: 14px 18px;
	background: var(--thscg-ink);
	color: var(--thscg-cream);
	border-radius: var(--thscg-radius-md);
	font-family: 'Fraunces', Georgia, serif;
	font-weight: 600;
	font-size: 17px;
	letter-spacing: 0.01em;
	text-align: left;
	transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	box-shadow: var(--thscg-shadow);
}

#thscg-root .thscg-class-btn > span:first-child {
	white-space: normal;
	overflow-wrap: anywhere;
	line-height: 1.25;
}

#thscg-root .thscg-class-btn:hover {
	transform: translateY(-2px);
	box-shadow: var(--thscg-shadow-hover);
}

#thscg-root .thscg-class-btn:focus-visible {
	outline: 2px solid var(--thscg-coral);
	outline-offset: 2px;
}

#thscg-root .thscg-class-btn.is-open {
	background: var(--thscg-coral);
	color: #fff;
}

#thscg-root .thscg-chevron {
	flex: 0 0 auto;
	font-size: 13px;
	opacity: 0.85;
	transition: transform 0.2s ease;
}

#thscg-root .thscg-class-btn.is-open .thscg-chevron {
	transform: rotate(180deg);
}

/* ---------------------------------------------------------
   Expand panel — "pick a section"
   --------------------------------------------------------- */
#thscg-root .thscg-expand {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
}

#thscg-root .thscg-expand.is-open {
	max-height: 2000px;
}

#thscg-root .thscg-expand-inner {
	background: var(--thscg-cream-deep);
	border: 1px solid var(--thscg-line);
	border-radius: var(--thscg-radius-lg);
	padding: 18px clamp(14px, 3vw, 22px) 20px;
	margin-top: 10px;
}

#thscg-root .thscg-expand-title {
	font-family: 'Fraunces', Georgia, serif;
	font-weight: 600;
	font-size: 15px;
	color: var(--thscg-ink-soft);
	margin: 0 0 14px;
}

/* Section tags — width follows content, never clipped.
   .thscg-section-dot holds the name (plain inline text, NOT a circle);
   .thscg-section-count is a small pill badge next to it. */
#thscg-root .thscg-sections {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 12px;
}

#thscg-root .thscg-section-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	width: auto;
	max-width: 100%;
	padding: 10px 16px;
	background: var(--thscg-paper);
	border: 1px solid var(--thscg-line);
	border-radius: 999px;
	transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
	box-shadow: var(--thscg-shadow);
}

#thscg-root .thscg-section-btn:hover {
	transform: translateY(-1px);
	border-color: var(--thscg-coral);
}

#thscg-root .thscg-section-btn:focus-visible {
	outline: 2px solid var(--thscg-coral);
	outline-offset: 2px;
}

#thscg-root .thscg-section-dot {
	/* NOT a circle — plain flexible label text */
	display: inline-block;
	width: auto;
	height: auto;
	border-radius: 0;
	background: none;
	font-family: 'Fraunces', Georgia, serif;
	font-weight: 600;
	font-size: 14px;
	color: var(--thscg-ink);
	white-space: normal;
	overflow-wrap: anywhere;
	line-height: 1.3;
}

#thscg-root .thscg-section-count {
	flex: 0 0 auto;
	padding: 3px 9px;
	border-radius: 999px;
	background: var(--thscg-cream-deep);
	color: var(--thscg-muted);
	font-family: 'Work Sans', sans-serif;
	font-size: 11px;
	font-weight: 700;
	white-space: nowrap;
}

#thscg-root .thscg-section-btn.is-open,
#thscg-root .thscg-section-btn[aria-pressed="true"] {
	background: var(--thscg-coral);
	border-color: var(--thscg-coral);
}

#thscg-root .thscg-section-btn.is-open .thscg-section-dot,
#thscg-root .thscg-section-btn[aria-pressed="true"] .thscg-section-dot {
	color: #fff;
}

#thscg-root .thscg-section-btn.is-open .thscg-section-count,
#thscg-root .thscg-section-btn[aria-pressed="true"] .thscg-section-count {
	background: rgba(255, 255, 255, 0.28);
	color: #fff;
}

#thscg-root .thscg-section-btn.is-empty,
#thscg-root .thscg-section-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	box-shadow: none;
}

#thscg-root .thscg-section-btn.is-empty:hover,
#thscg-root .thscg-section-btn:disabled:hover {
	transform: none;
	border-color: var(--thscg-line);
}

/* ---------------------------------------------------------
   Breadcrumb (back to all classes)
   --------------------------------------------------------- */
#thscg-root .thscg-crumb {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 18px;
	padding: 8px 4px;
	color: var(--thscg-coral-deep);
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: gap 0.15s ease;
}

#thscg-root .thscg-crumb:hover {
	gap: 12px;
}

#thscg-root .thscg-back-arrow {
	font-size: 16px;
}

/* ---------------------------------------------------------
   Gallery header
   --------------------------------------------------------- */
#thscg-root .thscg-gallery-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin: 0 0 22px;
}

#thscg-root .thscg-gallery-header h2 {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-family: 'Fraunces', Georgia, serif;
	font-weight: 600;
	font-size: clamp(19px, 2.6vw, 24px);
	color: var(--thscg-ink);
}

#thscg-root .thscg-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	height: 30px;
	padding: 0 10px;
	border-radius: 999px;
	background: var(--thscg-coral);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
}

#thscg-root .thscg-gallery-meta {
	color: var(--thscg-muted);
	font-size: 13px;
	font-weight: 500;
}

/* ---------------------------------------------------------
   Albums + photo grid, 4 per row
   --------------------------------------------------------- */
#thscg-root .thscg-album-title {
	font-family: 'Fraunces', Georgia, serif;
	font-weight: 600;
	font-size: 16px;
	color: var(--thscg-ink);
	margin: 0 0 12px;
	padding-left: 12px;
	border-left: 3px solid var(--thscg-coral);
}

#thscg-root .thscg-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin: 0 0 26px;
}

@media (max-width: 780px) {
	#thscg-root .thscg-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
	#thscg-root .thscg-grid { grid-template-columns: repeat(2, 1fr); }
}

#thscg-root .thscg-thumb {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--thscg-radius-sm);
	background: var(--thscg-cream-deep);
	box-shadow: var(--thscg-shadow);
}

#thscg-root .thscg-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

#thscg-root .thscg-thumb:hover img {
	transform: scale(1.06);
}

#thscg-root .thscg-thumb::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(43,32,24,0.35), transparent 45%);
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
}

#thscg-root .thscg-thumb:hover::after {
	opacity: 1;
}

#thscg-root .thscg-thumb:focus-visible {
	outline: 2px solid var(--thscg-coral);
	outline-offset: 2px;
}

#thscg-root .thscg-empty {
	padding: 30px 16px;
	text-align: center;
	color: var(--thscg-muted);
	font-size: 14px;
	background: var(--thscg-cream-deep);
	border: 1px solid var(--thscg-line);
	border-radius: var(--thscg-radius-lg);
}

/* ---------------------------------------------------------
   Lightbox
   --------------------------------------------------------- */
.thscg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(20, 14, 10, 0.92);
	padding: 24px;
	font-family: 'Work Sans', sans-serif;
}

.thscg-lightbox.is-open {
	display: flex;
}

.thscg-lightbox img {
	max-width: 90vw;
	max-height: 82vh;
	border-radius: 6px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.thscg-lightbox .thscg-lb-caption {
	position: absolute;
	bottom: 26px;
	left: 0;
	right: 0;
	text-align: center;
	color: #f1e4d3;
	font-size: 13px;
	letter-spacing: 0.02em;
}

.thscg-lightbox .thscg-lb-btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255,255,255,0.08);
	color: #faf3e8;
	font-size: 16px;
	border: 0;
	cursor: pointer;
	transition: background 0.18s ease;
}

.thscg-lightbox .thscg-lb-btn:hover {
	background: var(--thscg-coral, #e4693a);
}

.thscg-lightbox .thscg-lb-close { top: 20px; right: 20px; }
.thscg-lightbox .thscg-lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.thscg-lightbox .thscg-lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

@media (max-width: 560px) {
	.thscg-lightbox .thscg-lb-prev,
	.thscg-lightbox .thscg-lb-next { width: 38px; height: 38px; font-size: 14px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	#thscg-root *,
	.thscg-lightbox * {
		transition: none !important;
	}
}
