/*
 * STORY Stock Photos — Public Stylesheet
 * Adobe Stock-style grid with inline expansion panel and CSS watermark.
 */

/* ============================================================
   Custom Properties
   ============================================================ */
.ssp-gallery {
	--ssp-columns:       3;
	--ssp-gap:           14px;
	--ssp-thumb-radius:  5px;
	--ssp-overlay-bg:    rgba(0, 0, 0, 0.42);
	--ssp-panel-bg:      #f7f7f7;
	--ssp-panel-border:  #d6d6d6;
	--ssp-watermark-clr: rgba(255, 255, 255, 0.82);
	--ssp-btn-bg:        #0073aa;
	--ssp-btn-hover:     #005177;
	--ssp-btn-text:      #ffffff;
	--ssp-panel-radius:  6px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ============================================================
   No-photos message
   ============================================================ */
.ssp-no-photos {
	color: #666;
	font-style: italic;
	padding: 20px 0;
}

/* ============================================================
   Grid
   ============================================================ */
.ssp-grid {
	display: grid;
	grid-template-columns: repeat( var(--ssp-columns), 1fr );
	gap: var(--ssp-gap);
	align-items: start;
}

/* ============================================================
   Thumbnail cards
   ============================================================ */
.ssp-thumb-wrap {
	position: relative;
	cursor: pointer;
	border-radius: var(--ssp-thumb-radius);
	background: #ddd;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	outline: none;
}

/* Keyboard-focus ring */
.ssp-thumb-wrap:focus-visible {
	outline: 3px solid #005177;
	outline-offset: 2px;
}

/* Active state: indicate the currently opened photo */
.ssp-thumb-wrap.ssp-active {
	outline: 3px solid var(--ssp-btn-bg);
	outline-offset: 2px;
}

.ssp-thumb-inner {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.ssp-thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.ssp-thumb-wrap:hover .ssp-thumb-img,
.ssp-thumb-wrap:focus-visible .ssp-thumb-img {
	transform: scale(1.05);
}

/* ============================================================
   Thumbnail overlay (hover)
   ============================================================ */
.ssp-thumb-overlay {
	position: absolute;
	inset: 0;
	background: var(--ssp-overlay-bg);
	opacity: 0;
	transition: opacity 0.25s ease;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-end;
	padding: 10px 12px;
	gap: 4px;
}

.ssp-thumb-wrap:hover .ssp-thumb-overlay,
.ssp-thumb-wrap:focus-visible .ssp-thumb-overlay,
.ssp-thumb-wrap.ssp-active .ssp-thumb-overlay {
	opacity: 1;
}

.ssp-file-badge {
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	background: rgba(0, 0, 0, 0.55);
	padding: 2px 7px;
	border-radius: 3px;
	line-height: 1.5;
}

.ssp-view-hint {
	color: rgba(255, 255, 255, 0.90);
	font-size: 0.75rem;
	font-weight: 500;
}

/* ============================================================
   Expansion panel
   Spans all grid columns — placed by JS after the last
   thumbnail in the clicked row so CSS Grid puts it on a
   new full-width row below.
   ============================================================ */
.ssp-expansion-panel {
	grid-column: 1 / -1;
	background: var(--ssp-panel-bg);
	border: 1px solid var(--ssp-panel-border);
	border-radius: var(--ssp-panel-radius);
	position: relative;

	/* Collapsed state */
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	padding: 0 28px;
	border-width: 0;
	transition:
		max-height 0.38s ease,
		opacity    0.28s ease,
		padding    0.28s ease,
		border-width 0.01s 0.28s;
}

.ssp-expansion-panel.ssp-panel-open {
	max-height: 700px;
	opacity: 1;
	padding: 28px;
	border-width: 1px;
	overflow: visible;
	transition:
		max-height 0.38s ease,
		opacity    0.28s ease,
		padding    0.28s ease,
		border-width 0s;
}

/* Close button (top-right corner) */
.ssp-panel-close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 4px;
	font-size: 18px;
	line-height: 1;
	padding: 4px 9px;
	cursor: pointer;
	color: #555;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.ssp-panel-close:hover,
.ssp-panel-close:focus-visible {
	background: rgba(0, 0, 0, 0.07);
	border-color: #bbb;
	outline: none;
}

/* Inner layout: photo left, info right */
.ssp-panel-inner {
	display: flex;
	gap: 36px;
	align-items: flex-start;
}

/* ============================================================
   Photo + watermark (inside expansion panel)
   ============================================================ */
.ssp-panel-photo-wrap {
	position: relative;
	flex: 0 0 auto;
	max-width: 52%;
	line-height: 0; /* remove inline-block gap */
}

.ssp-panel-img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}

/*
 * Watermark strip
 * Sits over the LEFT EDGE of the expanded photo.
 * Text is rotated -90deg so it reads bottom → top (going upward).
 */
.ssp-watermark {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none; /* never intercepts clicks */
	background: linear-gradient(
		to right,
		rgba(0, 0, 0, 0.38) 0%,
		rgba(0, 0, 0, 0.08) 100%
	);
	border-radius: 4px 0 0 4px;
	z-index: 2;
	overflow: hidden;
}

.ssp-watermark-text {
	display: block;
	color: var(--ssp-watermark-clr);
	font-size: 10.5px;
	font-weight: 700;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	letter-spacing: 0.13em;
	white-space: nowrap;
	user-select: none;

	/*
	 * rotate(-90deg) = counterclockwise rotation.
	 * The text string runs from the bottom of the strip to the top —
	 * exactly like a spine label or Adobe Stock's file-number watermark.
	 */
	transform: rotate(-90deg);
	transform-origin: center center;
}

/* ============================================================
   Info panel (right side)
   ============================================================ */
.ssp-panel-info {
	flex: 1 1 auto;
	min-width: 0;
}

.ssp-panel-title {
	font-size: 1.2rem;
	font-weight: 600;
	margin: 0 0 18px;
	line-height: 1.3;
	color: #1a1a1a;
}

/* License terms scroll box */
.ssp-license-box {
	background: #eaf4fb;
	border: 1px solid #b8d8ea;
	border-radius: 5px;
	padding: 14px 16px;
	font-size: 0.83rem;
	line-height: 1.65;
	color: #2c3e50;
	max-height: 230px;
	overflow-y: auto;
	margin-bottom: 20px;
	scrollbar-width: thin;
}

.ssp-license-box h3 {
	font-size: 0.88rem;
	font-weight: 700;
	margin: 0 0 10px;
	color: #1a3a52;
}

.ssp-license-box p {
	margin: 0 0 8px;
}

.ssp-license-box ul {
	margin: 4px 0 10px 18px;
	padding: 0;
}

.ssp-license-box li {
	margin-bottom: 4px;
}

.ssp-license-box a {
	color: #005177;
}

/* Agree & Download CTA */
.ssp-agree-btn {
	display: inline-block;
	background: var(--ssp-btn-bg);
	color: var(--ssp-btn-text);
	border: none;
	padding: 13px 30px;
	font-size: 1rem;
	font-weight: 700;
	border-radius: 4px;
	cursor: pointer;
	letter-spacing: 0.01em;
	transition: background 0.2s ease, transform 0.1s ease;
}

.ssp-agree-btn:hover:not(:disabled) {
	background: var(--ssp-btn-hover);
}

.ssp-agree-btn:active:not(:disabled) {
	transform: scale(0.98);
}

.ssp-agree-btn:focus-visible {
	outline: 3px solid #005177;
	outline-offset: 2px;
}

.ssp-agree-btn:disabled {
	opacity: 0.60;
	cursor: default;
}

.ssp-license-summary {
	font-size: 0.76rem;
	color: #777;
	margin: 10px 0 0;
	line-height: 1.5;
}

/* ============================================================
   Filter Bar
   ============================================================ */
.ssp-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px;
	margin-bottom: 20px;
	padding: 18px 20px;
	background: #f0f4f8;
	border: 1px solid #d4dde6;
	border-radius: 6px;
}

.ssp-filter-group {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.ssp-filter-label {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #4a5568;
}

.ssp-filter-select {
	appearance: none;
	-webkit-appearance: none;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234a5568'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	border: 1px solid #b0bec5;
	border-radius: 4px;
	padding: 8px 32px 8px 12px;
	font-size: 0.88rem;
	color: #2d3748;
	cursor: pointer;
	min-width: 180px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ssp-filter-select:hover {
	border-color: var(--ssp-btn-bg);
}

.ssp-filter-select:focus {
	outline: none;
	border-color: var(--ssp-btn-bg);
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.18);
}

/* Active filter: blue tint to show it's filtering */
.ssp-filter-select.ssp-filter-active {
	border-color: var(--ssp-btn-bg);
	background-color: #eaf4fb;
}

.ssp-filter-reset {
	background: transparent;
	border: 1px solid #b0bec5;
	border-radius: 4px;
	padding: 8px 16px;
	font-size: 0.85rem;
	color: #4a5568;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	align-self: flex-end;
}

.ssp-filter-reset:hover {
	background: #e2e8f0;
	border-color: #718096;
	color: #2d3748;
}

.ssp-filter-reset:focus-visible {
	outline: 3px solid var(--ssp-btn-bg);
	outline-offset: 2px;
}

.ssp-filter-no-results {
	color: #718096;
	font-style: italic;
	padding: 32px 0;
	text-align: center;
	grid-column: 1 / -1;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet: 2 columns */
@media ( max-width: 900px ) {
	.ssp-gallery { --ssp-columns: 2; }

	.ssp-panel-inner {
		flex-direction: column;
	}

	.ssp-panel-photo-wrap {
		max-width: 100%;
		width: 100%;
	}
}

/* Mobile: 1 column */
@media ( max-width: 480px ) {
	.ssp-gallery { --ssp-columns: 1; }

	.ssp-filter-bar {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		padding: 14px;
	}

	.ssp-filter-select {
		min-width: 0;
		width: 100%;
	}

	.ssp-filter-reset {
		width: 100%;
		text-align: center;
	}

	.ssp-agree-btn {
		width: 100%;
		text-align: center;
	}

	.ssp-expansion-panel.ssp-panel-open {
		padding: 18px 14px;
	}
}
