/*
 * Social Profile — profile pages.
 * --accent is set inline from Settings → Social Profile (see includes/assets.php).
 */

/* ---------- Base ---------- */

.sp-body {
	--bg: #f4f0ea;
	--card: #fffdf9;
	--text: #1c1b19;
	--muted: #6f6b66;
	--border: #ebe5dc;
	--hover: #faf6f0;
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 15px;
	-webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
	.sp-body {
		--bg: #0f0e0d;
		--card: #171615;
		--text: #f2efea;
		--muted: #9b968f;
		--border: #2a2826;
		--hover: #1d1c1a;
	}
}

.sp-page {
	max-width: 620px;
	margin: 0 auto;
	padding-bottom: 24px;
}

.sp-page a {
	color: inherit;
	text-decoration: none;
}

.sp-panel {
	margin-top: 24px;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: 28px;
	background: var(--card);
}

@media (max-width: 660px) {
	.sp-panel {
		margin-top: 0;
		border-right: 0;
		border-left: 0;
		border-radius: 0;
	}
}

.sp-muted {
	color: var(--muted);
}

.sp-page mark {
	padding: 0 2px;
	border-radius: 4px;
	background: #fde68a;
	background: color-mix(in srgb, var(--accent) 24%, transparent);
	color: inherit;
}

.sp-badge {
	padding: 1px 8px;
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--muted);
	font-size: 12px;
}

.sp-notice {
	margin: 0 0 8px;
	padding: 10px 14px;
	border-radius: 14px;
	background: var(--bg);
	color: var(--accent);
	font-size: 14px;
}

.sp-notice:empty {
	display: none;
}

.sp-empty {
	margin: 0;
	padding: 56px 16px;
	border-top: 1px solid var(--border);
	color: var(--muted);
	text-align: center;
}

.sp-back {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 20px;
	font-size: 17px;
	font-weight: 600;
}

.sp-back-count {
	margin-left: auto;
	font-size: 14px;
	font-weight: 400;
}

.sp-pagination {
	display: flex;
	justify-content: space-between;
	padding: 16px 20px;
	border-top: 1px solid var(--border);
}

.sp-page .sp-pagination a {
	color: var(--accent);
	font-weight: 600;
}

.sp-footer {
	padding: 20px;
	color: var(--muted);
	font-size: 13px;
	text-align: center;
}

/* ---------- Profile header ---------- */

.sp-cover {
	height: 210px;
	background-color: var(--accent);
	background-position: center;
	background-size: cover;
}

@media (max-width: 660px) {
	.sp-cover {
		height: 150px;
	}
}

.sp-profile {
	padding: 0 24px 18px;
}

.sp-profile-avatar {
	display: block;
	width: 112px;
	height: 112px;
	margin-top: -56px;
	border: 5px solid var(--card);
	border-radius: 50%;
	background: var(--card);
	object-fit: cover;
}

.sp-profile-name {
	margin: 10px 0 2px;
	font-family: "Fraunces", Georgia, serif;
	font-size: 30px;
	font-weight: 600;
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.sp-bio {
	margin: 12px 0 0;
	font-size: 16px;
	line-height: 1.5;
}

.sp-profile-links {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 12px;
	color: var(--muted);
	font-size: 14px;
}

.sp-profile-links span,
.sp-profile-links a {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.sp-page .sp-profile-links a {
	color: var(--accent);
}

.sp-stats {
	display: flex;
	gap: 18px;
	margin-top: 12px;
	color: var(--muted);
	font-size: 14px;
}

.sp-stats b {
	color: var(--text);
	font-weight: 600;
}

.sp-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 14px;
}

.sp-page .sp-chips a {
	padding: 5px 11px;
	border-radius: 999px;
	background: var(--bg);
	color: var(--accent);
	font-size: 13px;
	font-weight: 600;
	transition: background 0.2s, color 0.2s;
}

.sp-page .sp-chips a:hover,
.sp-page .sp-chips a.is-active {
	background: var(--accent);
	color: #fff;
}

/* ---------- Tabs ---------- */

.sp-tabs {
	display: flex;
	gap: 6px;
	margin: 0 16px 14px;
	padding: 5px;
	overflow-x: auto;
	border-radius: 999px;
	background: var(--bg);
	scrollbar-width: none;
}

.sp-tabs a {
	flex: 1 0 auto;
	padding: 9px 12px;
	border-radius: 999px;
	color: var(--muted);
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	white-space: nowrap;
	transition: background 0.2s;
}

.sp-page .sp-tabs a.is-active {
	background: var(--accent);
	color: #fff;
}

.sp-page .sp-tabs a.sp-search-button {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	padding: 9px 16px;
}

.sp-page .sp-tabs a.sp-search-button:hover {
	color: var(--text);
}

/* ---------- Search ---------- */

.sp-search-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
}

.sp-page .sp-search-bar > a {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
}

.sp-page .sp-search-bar > a:hover {
	background: var(--bg);
}

.sp-search-form {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0 16px;
	border-radius: 999px;
	background: var(--bg);
	color: var(--muted);
}

.sp-search-form:focus-within {
	box-shadow: 0 0 0 2px var(--accent);
}

.sp-search-form input {
	flex: 1;
	min-width: 0;
	padding: 11px 0;
	border: 0;
	outline: 0;
	background: none;
	color: var(--text);
	font: inherit;
	font-size: 16px;
}

.sp-search-info {
	padding: 4px 20px 16px;
	color: var(--muted);
	font-size: 14px;
}

.sp-search-info .sp-chips {
	margin-top: 10px;
}

/* ---------- Entries (posts and reading list items) ---------- */

.sp-entry {
	position: relative;
	display: flex;
	gap: 12px;
	padding: 16px 20px;
	border-top: 1px solid var(--border);
}

.sp-entry:hover {
	background: var(--hover);
}

.sp-entry[data-href] {
	cursor: pointer;
}

.sp-avatar {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
}

.sp-entry-body {
	flex: 1;
	min-width: 0;
}

.sp-entry-meta {
	display: flex;
	align-items: baseline;
	gap: 6px;
	overflow: hidden;
	white-space: nowrap;
}

.sp-entry-meta b {
	font-weight: 600;
}

.sp-entry-meta .sp-muted {
	overflow: hidden;
	text-overflow: ellipsis;
}

.sp-entry--manageable .sp-entry-meta {
	padding-right: 30px;
}

.sp-entry-title {
	margin-top: 4px;
	font-family: "Fraunces", Georgia, serif;
	font-size: 18px;
	font-weight: 600;
}

.sp-pinned-label {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 2px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

.sp-single .sp-entry:hover {
	background: none;
}

.sp-single .sp-content {
	font-size: 18px;
}

/* Content */

.sp-content {
	margin-top: 4px;
	font-size: 15.5px;
	line-height: 1.55;
	overflow-wrap: anywhere;
}

.sp-content p {
	margin: 0 0 8px;
}

.sp-content figure {
	margin: 10px 0;
}

.sp-content img {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: 18px;
}

.sp-content img:not(.emoji) {
	cursor: zoom-in;
}

.sp-content iframe {
	display: block;
	max-width: 100%;
	border: 0;
	border-radius: 18px;
}

.sp-content iframe[src*="youtube.com"],
.sp-content iframe[src*="youtube-nocookie.com"],
.sp-content iframe[src*="vimeo.com"] {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

.sp-content .wp-block-embed {
	margin: 10px 0;
}

.sp-page .sp-content a {
	color: var(--accent);
}

/* Actions row: replies, like, share */

.sp-actions {
	display: flex;
	gap: 12px;
	margin: 4px 0 0 -9px;
}

.sp-page .sp-actions a,
.sp-page .sp-actions button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 9px;
	border: 0;
	border-radius: 999px;
	background: none;
	color: var(--muted);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.sp-page .sp-actions a:hover,
.sp-page .sp-actions button:hover {
	background: var(--bg);
	color: var(--accent);
}

.sp-page .sp-actions .sp-like.is-active {
	color: var(--accent);
}

.sp-like.is-active svg {
	fill: currentColor;
}

.sp-actions span:empty {
	display: none;
}

.sp-actions .sp-badge {
	align-self: center;
}

.sp-single .sp-actions {
	margin-top: 14px;
}

/* ---------- Post menu ---------- */

.sp-menu {
	position: absolute;
	top: 12px;
	right: 12px;
}

.sp-menu summary {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	color: var(--muted);
	list-style: none;
	cursor: pointer;
}

.sp-menu summary::-webkit-details-marker {
	display: none;
}

.sp-menu summary:hover,
.sp-menu[open] summary {
	background: var(--bg);
	color: var(--text);
}

.sp-menu-items {
	position: absolute;
	top: 36px;
	right: 0;
	z-index: 5;
	min-width: 190px;
	padding: 6px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--card);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Open upwards on the last card so the panel doesn't clip the menu. */
.sp-panel > .sp-entry:last-of-type .sp-menu-items {
	top: auto;
	bottom: 36px;
}

.sp-menu-items form {
	margin: 0;
}

.sp-page .sp-menu-items a,
.sp-page .sp-menu-items button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-radius: 10px;
	background: none;
	color: var(--text);
	font: inherit;
	font-size: 14px;
	text-align: left;
	cursor: pointer;
}

.sp-page .sp-menu-items a:hover,
.sp-page .sp-menu-items button:hover {
	background: var(--bg);
}

.sp-page .sp-menu-items .sp-danger {
	color: #d93025;
}

/* ---------- Quick post ---------- */

.sp-composer {
	display: flex;
	gap: 12px;
	padding: 16px 20px;
	border-top: 1px solid var(--border);
}

.sp-composer textarea {
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-height: 46px;
	padding: 10px 0;
	border: 0;
	outline: 0;
	background: none;
	color: var(--text);
	font: inherit;
	font-size: 17px;
	line-height: 1.45;
	resize: none;
}

.sp-composer textarea::placeholder {
	color: var(--muted);
}

.sp-composer-preview {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px;
}

.sp-composer-preview:empty {
	display: none;
}

.sp-composer-preview img {
	display: block;
	width: 100%;
	border-radius: 10px;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.sp-composer-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 8px;
	padding-top: 10px;
	border-top: 1px solid var(--border);
}

.sp-composer-photo {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-left: -10px;
	padding: 6px 10px;
	border-radius: 999px;
	color: var(--accent);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.sp-composer-photo:hover {
	background: var(--bg);
}

.sp-composer-photo input {
	display: none;
}

.sp-composer button {
	padding: 9px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.sp-composer button:disabled {
	opacity: 0.5;
	cursor: default;
}

/* ---------- Photos grid ---------- */

.sp-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4px;
	padding: 4px;
	border-top: 1px solid var(--border);
}

.sp-grid a {
	display: block;
	overflow: hidden;
	border-radius: 10px;
	background: var(--hover);
	aspect-ratio: 1 / 1;
}

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

.sp-grid a:hover img {
	transform: scale(1.04);
}

/* ---------- Lightbox ---------- */

.sp-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 9, 8, 0.94);
	color: #fff;
	touch-action: pinch-zoom;
}

.sp-lightbox[hidden],
.sp-lightbox [hidden] {
	display: none;
}

.sp-lightbox img {
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 128px);
	max-height: calc(100dvh - 128px);
	border-radius: 8px;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

.sp-lightbox button {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
}

.sp-lightbox button:hover,
.sp-lightbox button:focus-visible {
	background: rgba(255, 255, 255, 0.24);
}

.sp-lightbox svg {
	width: 22px;
	height: 22px;
}

.sp-lightbox-close {
	top: 16px;
	right: 16px;
}

.sp-lightbox-prev,
.sp-lightbox-next {
	top: 50%;
	transform: translateY(-50%);
}

.sp-lightbox-prev {
	left: 16px;
}

.sp-lightbox-next {
	right: 16px;
}

.sp-lightbox-footer {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 14px;
}

.sp-lightbox-footer a {
	margin-left: auto;
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

/* Swipe replaces the arrows on phones. */
@media (max-width: 660px) {
	.sp-lightbox .sp-lightbox-prev,
	.sp-lightbox .sp-lightbox-next {
		display: none;
	}

	.sp-lightbox img {
		max-width: 100vw;
		border-radius: 0;
	}
}

/* ---------- Projects ---------- */

.sp-projects {
	border-top: 1px solid var(--border);
}

.sp-project {
	padding: 16px 20px;
}

.sp-project + .sp-project {
	border-top: 1px solid var(--border);
}

.sp-project-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.sp-page .sp-project-name {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: var(--accent);
	font-size: 16px;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.sp-page .sp-project-name:hover {
	text-decoration: underline;
}

.sp-project-description {
	margin: 6px 0 0;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.sp-topics {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
}

.sp-topics span {
	padding: 3px 9px;
	border-radius: 999px;
	background: var(--bg);
	color: var(--accent);
	font-size: 12px;
	font-weight: 600;
}

.sp-project-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 16px;
	margin-top: 10px;
	color: var(--muted);
	font-size: 13px;
}

.sp-project-meta > * {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.sp-page .sp-project-meta a {
	color: var(--accent);
}

.sp-language-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--muted);
}

/* ---------- Comments ---------- */

.sp-comments {
	padding: 4px 20px 28px;
	border-top: 1px solid var(--border);
}

.sp-comments h3 {
	margin: 18px 0 8px;
	font-family: "Fraunces", Georgia, serif;
	font-size: 20px;
	font-weight: 600;
}

.sp-comments .comment {
	padding: 12px 0;
	border-bottom: 1px solid var(--border);
}

.sp-comments .children {
	margin-left: 18px;
	padding-left: 14px;
	border-left: 2px solid var(--border);
}

.sp-comments .children .comment {
	padding-bottom: 0;
	border-bottom: 0;
}

.sp-comments .avatar {
	margin-right: 6px;
	border-radius: 50%;
	vertical-align: middle;
}

.sp-comments .comment-meta,
.sp-comments .reply {
	color: var(--muted);
	font-size: 13px;
}

.sp-page .sp-comments .comment-reply-link {
	color: var(--accent);
	font-weight: 600;
}

.sp-page .sp-comments #cancel-comment-reply-link {
	margin-left: 10px;
	color: var(--muted);
	font-family: "Inter", sans-serif;
	font-size: 13px;
	font-weight: 400;
}

.sp-comments textarea,
.sp-comments input[type="text"],
.sp-comments input[type="email"],
.sp-comments input[type="url"] {
	box-sizing: border-box;
	width: 100%;
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--bg);
	color: var(--text);
	font: inherit;
}

.sp-comments input[type="submit"] {
	padding: 10px 24px;
	border: 0;
	border-radius: 999px;
	background: var(--accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
