/*
Theme Name: Porngify
Theme URI: https://porngify.com/
Author: Porngify
Author URI: https://porngify.com/
Description: Dark NSFW GIF and pic gallery for Porngify.
Version: 0.1.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
Text Domain: porngify
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

:root {
	--bg: #0a0a0a;
	--header: #111;
	--ink: #fff;
	--accent: #ff2ec8;
	--line: #333;
	--muted: #9a9a9a;
	--on-accent: #1a0414;
	--pink: var(--accent);
	--mint: var(--accent);
	--gap: 3px;
	--side: 280px;
	--head: 52px;
}

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

html { background: var(--bg); }

html.fm-gated,
body.fm-gated { overflow: hidden; }

body.fm-body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	color: var(--ink);
	font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
	font-size: 14px;
	line-height: 1.35;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; height: auto; display: block; }

button,
input { font: inherit; color: inherit; }

.screen-reader-text,
.fm-skip {
	position: absolute;
	left: -999px;
	top: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.fm-skip:focus {
	left: 10px;
	top: 10px;
	z-index: 90;
	width: auto;
	height: auto;
	background: var(--header);
	color: var(--ink);
	padding: 8px 12px;
}

/* Header */
.fm-header {
	position: sticky;
	top: 0;
	z-index: 60;
	background: var(--header);
	border-bottom: 1px solid #1c1c1c;
}

.fm-header-row {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: var(--head);
	height: var(--head);
	padding: 0 10px;
}

.fm-burger {
	appearance: none;
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 8px;
	border: 0;
	background: transparent;
	cursor: pointer;
}
.fm-burger span {
	display: block;
	height: 2px;
	background: var(--ink);
	border-radius: 1px;
}

.fm-wordmark {
	flex: 0 0 auto;
	font-weight: 700;
	font-size: 1.35rem;
	letter-spacing: -0.03em;
	line-height: 1;
	white-space: nowrap;
	color: var(--ink);
}
.fm-wordmark:hover { color: var(--ink); }
.fm-wm-fap { color: var(--ink); }
.fm-wm-muse { color: var(--accent); }

.fm-search {
	margin-left: auto;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	position: relative;
}
.fm-search-toggle {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
}
.fm-search-toggle:hover { color: var(--accent); }
.fm-search input[type="search"] {
	display: none;
	width: min(240px, 56vw);
	border: 1px solid var(--line);
	background: #141414;
	color: var(--ink);
	border-radius: 999px;
	padding: 7px 12px;
	outline: none;
}
.fm-search.is-open input[type="search"] { display: block; }
.fm-search.is-open .fm-search-toggle { display: none; }
.fm-search input[type="search"]:focus { border-color: var(--accent); }

/* Pills */
.fm-chip,
.fm-more,
.fm-btn,
.fm-rand,
.fm-next,
.fm-gate-ok {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	color: var(--ink);
}

.fm-chip {
	height: 32px;
	padding: 0 14px;
	border: 1px solid var(--line);
	background: transparent;
	white-space: nowrap;
}
.fm-chip:hover,
.fm-chip.is-on {
	border-color: var(--accent);
	color: var(--accent);
}

/* Shell: full-width main, drawer sidebar at every breakpoint */
.fm-shell {
	display: block;
	width: 100%;
	max-width: none;
	margin: 0;
}

.fm-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	z-index: 55;
	width: min(var(--side), 86vw);
	max-height: none;
	padding: calc(var(--head) + 8px) 16px 24px;
	overflow: auto;
	background: var(--header);
	transform: translateX(-105%);
	transition: transform 0.18s ease;
}
body.fm-nav-open .fm-sidebar { transform: translateX(0); }

.fm-side-home,
.fm-side-all {
	display: block;
	margin: 0 0 6px;
	font-weight: 700;
	font-size: 15px;
}
.fm-side-home.is-on,
.fm-side-home:hover,
.fm-side-all.is-on,
.fm-side-all:hover { color: var(--accent); }
.fm-side-h {
	margin: 14px 0 8px;
	font-size: 13px;
	font-weight: 700;
	color: var(--ink);
}
.fm-side-cats,
.fm-tags,
.fm-friends {
	list-style: none;
	margin: 0 0 8px;
	padding: 0;
}
.fm-side-cats a,
.fm-friends a {
	display: block;
	padding: 4px 0;
	font-size: 13px;
	color: var(--ink);
}
.fm-side-cats a:hover,
.fm-side-cats a.is-on { color: var(--accent); }
.fm-friends a { color: var(--accent); }
.fm-friends a:hover { color: var(--ink); }
.fm-tags a {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 0;
	font-size: 13px;
	color: var(--ink);
}
.fm-tags a:hover,
.fm-tags a.is-on { color: var(--accent); }
.fm-tag-n { color: var(--accent); font-variant-numeric: tabular-nums; }

.fm-scrim {
	display: block;
	position: fixed;
	inset: 0;
	z-index: 50;
	background: rgba(0, 0, 0, 0.55);
}
.fm-scrim[hidden] { display: none; }

.fm-main {
	width: 100%;
	max-width: none;
	min-width: 0;
	padding: 10px 10px 36px;
}

.fm-head { margin: 0 0 16px; }
.fm-h1,
.fm-h2 {
	margin: 0 0 6px;
	font-size: 1.55rem;
	line-height: 1.15;
	letter-spacing: -0.03em;
	font-weight: 700;
}
.fm-tag {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
}

.fm-h2 { margin: 18px 0 10px; }

/* Justified GIF grid (JS sets per-card width/height) */
.fm-grid {
	display: flex;
	flex-wrap: wrap;
	align-content: flex-start;
	gap: var(--gap);
}

.fm-card {
	position: relative;
	flex: 0 0 auto;
	width: 180px;
	height: 180px;
	margin: 0;
	overflow: hidden;
	background: #101010;
	border: 1px solid #444;
}
.fm-card-link {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	color: inherit;
}
.fm-card-link:hover { color: inherit; }
.fm-card-media {
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #101010;
}
.fm-card-media picture {
	display: block;
	width: 100%;
	height: 100%;
}
.fm-card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transform-origin: center center;
	transition: transform 0.22s ease;
}
.fm-card:hover .fm-card-media img {
	transform: scale(1.09);
}
.fm-ph {
	width: 100%;
	height: 100%;
	min-height: 80px;
	background: #101010;
}

.fm-card-title {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	margin: 0;
	padding: 22px 8px 8px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.3;
	color: #fff;
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.88));
	opacity: 0;
	pointer-events: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: opacity 0.16s ease;
}
.fm-card:hover .fm-card-title { opacity: 1; }
.fm-card-cat { display: none; }

.fm-more-wrap {
	display: flex;
	justify-content: center;
	margin: 22px 0 4px;
}
.fm-more {
	height: 36px;
	padding: 0 22px;
	border: 1px solid var(--line);
	background: transparent;
	color: var(--ink);
}
.fm-more:hover {
	border-color: var(--accent);
	color: var(--accent);
}
.fm-more[data-busy="1"] { opacity: 0.55; }

.fm-empty {
	padding: 56px 16px;
	text-align: center;
	color: var(--muted);
}

/* Single */
.fm-single { max-width: 860px; margin: 0 auto; }
.fm-single-title {
	margin: 0 0 14px;
	font-size: 1.45rem;
	letter-spacing: -0.02em;
	font-weight: 700;
}
.fm-stage {
	display: block;
	position: relative;
	background: #111;
	max-width: 100%;
	margin: 0;
	color: inherit;
}
a.fm-stage,
a.fm-stage:hover {
	color: inherit;
}
.fm-stage img {
	width: 100%;
	height: auto;
	margin: 0 auto;
}
.fm-embed {
	position: relative;
	width: 100%;
	padding-top: 56.25%;
	background: #000;
}
.fm-embed iframe,
.fm-embed video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.fm-video-fallback {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.fm-live-now {
	margin: 18px 0 10px;
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}
.fm-live-now:has(+ #gallery-cams:empty) { display: none; }

.fm-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 14px 0 10px;
}
.fm-btn {
	height: 34px;
	padding: 0 14px;
	border: 1px solid var(--line);
	background: transparent;
	cursor: pointer;
}
.fm-btn:hover {
	border-color: var(--accent);
	color: var(--accent);
}
.fm-desc {
	margin: 0 0 12px;
	color: #ddd;
	font-size: 14px;
}
.fm-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 22px;
}

.fm-strip {
	display: flex;
	gap: 10px;
	align-items: stretch;
	margin-top: 8px;
}
.fm-rand {
	flex: 0 0 auto;
	min-width: 110px;
	padding: 0 16px;
	border: 0;
	border-radius: 6px;
	background: #2a2a2a;
	color: var(--ink);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-size: 12px;
}
.fm-rand:hover { color: var(--ink); background: #363636; }
.fm-next {
	flex: 1 1 auto;
	min-width: 0;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 10px 8px 16px;
	border: 0;
	border-radius: 6px;
	background: var(--accent);
	color: var(--on-accent);
	text-align: left;
}
.fm-next:hover { color: var(--on-accent); filter: brightness(1.06); }
.fm-next-copy {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.fm-next-k {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.85;
}
.fm-next-t {
	font-size: 14px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.fm-next-c { font-size: 12px; opacity: 0.9; }
.fm-next img {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: 4px;
	flex: 0 0 auto;
}

.fm-related { margin-top: 28px; width: 100%; max-width: 100%; }
.fm-related .fm-grid { width: 100%; max-width: 100%; }
.fm-related-h {
	margin: 0 0 12px;
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}

/* /all/ */
.fm-cat-dir {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}
@media (min-width: 700px) {
	.fm-cat-dir { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
	.fm-cat-dir { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.fm-cat {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	min-height: 120px;
	padding: 12px;
	overflow: hidden;
	background: #111;
	color: var(--ink);
}
.fm-cat:hover { color: var(--ink); }
.fm-cat-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	opacity: 0.45;
}
.fm-cat-name,
.fm-cat-n { position: relative; z-index: 1; }
.fm-cat-name { font-weight: 700; font-size: 1.05rem; }
.fm-cat-n { color: var(--accent); font-size: 12px; margin-top: 2px; }

.fm-footer {
	padding: 18px 16px 32px;
	text-align: center;
	color: var(--muted);
	font-size: 12px;
}
.fm-footer p { margin: 0 0 8px; }
.fm-legal { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.fm-footer a { color: var(--muted); }
.fm-footer a:hover { color: var(--accent); }

/* Age gate */
.fm-gate {
	position: fixed;
	inset: 0;
	z-index: 80;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(0, 0, 0, 0.94);
}
.fm-gate[hidden] { display: none; }
.fm-gate-card {
	width: min(100%, 360px);
	background: #141414;
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 28px 24px 24px;
	text-align: center;
}
.fm-gate-card h2 {
	margin: 0 0 18px;
	font-size: 1.2rem;
}
.fm-gate-ok {
	appearance: none;
	border: 0;
	background: var(--accent);
	color: var(--on-accent);
	font-weight: 700;
	padding: 12px 20px;
	cursor: pointer;
}
.fm-gate-ok:hover { filter: brightness(1.06); }

@media (max-width: 800px) {
	.fm-strip { flex-direction: column; }
	.fm-rand { min-height: 44px; }
}

.fm-legal-page { max-width: 42rem; padding: 8px 4px 40px; }
.fm-legal-body { color: var(--muted); font-size: 15px; line-height: 1.7; }
.fm-legal-body h2 { color: var(--ink); font-size: 1.05rem; margin: 28px 0 10px; }
.fm-legal-body h3 { color: var(--ink); font-size: 0.95rem; margin: 18px 0 8px; }
.fm-legal-body p { margin: 0 0 14px; }
.fm-legal-body ul { margin: 0 0 16px; padding-left: 22px; }
.fm-legal-body a { color: var(--accent); }

.fm-trending { margin: 0 0 22px; }
.fm-trending-h {
	margin: 0 0 10px;
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}
.fm-trending-row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--gap);
}
.fm-trending-row .fm-card {
	width: auto;
	height: auto;
	margin: 0;
}
.fm-trending-row .fm-card-media {
	aspect-ratio: 4 / 3;
}
@media (min-width: 760px) { .fm-trending-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .fm-trending-row { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
