/*
Theme Name: Nightcave
Theme URI: http://localhost/wordpress/
Author: Nightcave
Description: เทมเพลตแมกกาซีนพื้นหลังเข้ม แถบม่วง แถวหมวดหมู่ การ์ดบทความ และแถบข้าง
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nightcave
Tags: blog, news, two-columns, right-sidebar, custom-logo, custom-menu, custom-colors, featured-images, threaded-comments
*/

:root {
	--accent: #5b2c86;
	--bg: #111111;
	--ink: #ffffff;
	--muted: #b5b5b5;
	--card: #1a1a1a;
	--line: #2a2a2a;
	--wrap: 1140px;
}

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

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: "Noto Sans Thai", Lato, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.6;
	color-scheme: dark;
}

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

button,
input,
textarea {
	font: inherit;
}

a {
	color: inherit;
}

.container {
	width: min(var(--wrap), calc(100% - 32px));
	margin: 0 auto;
}

.container.narrow {
	width: min(760px, calc(100% - 32px));
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	clip: auto;
	clip-path: none;
	height: auto;
	width: auto;
	margin: 0;
	padding: 8px 12px;
	background: #fff;
	color: #111;
	z-index: 100000;
}

.skip-link {
	position: absolute;
	left: 12px;
	top: -48px;
	background: #fff;
	color: #111;
	padding: 8px 12px;
	z-index: 100000;
	text-decoration: none;
}

.skip-link:focus {
	top: 8px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
	outline: 2px solid #c9a6ff;
	outline-offset: 2px;
}

.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
}

@media screen and (min-width: 783px) {
	.admin-bar .site-header {
		top: 32px;
	}
}

.topbar {
	background: linear-gradient(180deg, #3a1570 0%, #1a0836 72%, #0c0614 100%);
	padding: 14px 0 16px;
}

.topbar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
}

.topbar-brand {
	min-width: 0;
	text-align: left;
}

.topbar-tools {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	flex: 0 0 auto;
}

.topbar-date {
	margin: 0;
	font-size: 14px;
	text-align: right;
}

.social-row {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.social-link {
	width: 42px;
	height: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	text-decoration: none;
}

.social-link svg {
	width: 22px;
	height: 22px;
	display: block;
}

.social-link.is-whatsapp { background: #25d366; }
.social-link.is-telegram { background: #2aabee; }
.social-link.is-tiktok { background: #111111; }
.social-link.is-x { background: #111111; }
.social-link.is-website { background: #ffffff; }

.social-link:hover {
	filter: brightness(1.08);
}

.brand-heading {
	margin: 0;
	font-size: 40px;
	line-height: 1;
	font-weight: 700;
	text-align: left;
}

.brand-heading a {
	color: #fff;
	text-decoration: none;
}

.custom-logo-link {
	display: inline-block;
	line-height: 0;
}

.custom-logo {
	max-width: min(280px, 46vw);
	max-height: 84px;
	width: auto;
	height: auto;
}

.site-banner {
	background: #0d0d0d;
	padding: 18px 0 8px;
}

.site-banner a {
	display: block;
	line-height: 0;
}

.site-banner img {
	width: 100%;
	height: auto;
	display: block;
}

.brand-desc {
	margin: 8px 0 0;
	color: #d5d5d5;
	font-size: 13px;
	text-align: left;
	max-width: 360px;
}

.nav-bar {
	background: #14091f;
}

.nav-inner {
	position: relative;
	min-height: 54px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.menu-toggle,
.search-toggle {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 42px;
	height: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	color: #fff;
	cursor: pointer;
	padding: 0;
}

.menu-toggle { left: 0; display: none; }
.search-toggle { right: 0; }
.search-toggle svg { width: 20px; height: 20px; }

.ham,
.ham::before,
.ham::after {
	display: block;
	width: 20px;
	height: 2px;
	background: #fff;
	position: relative;
}

.ham::before,
.ham::after {
	content: "";
	position: absolute;
	left: 0;
}

.ham::before { top: -6px; }
.ham::after { top: 6px; }

.primary-menu {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 22px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.primary-menu a {
	display: block;
	padding: 16px 0;
	color: #fff;
	text-decoration: none;
	font-size: 15px;
	white-space: nowrap;
}

.primary-menu a:hover,
.primary-menu .current-menu-item > a,
.primary-menu .current_page_item > a {
	color: #e4d4ff;
}

.primary-menu .sub-menu {
	display: none;
	list-style: none;
	margin: 0;
	padding: 8px 0;
}

.primary-menu li {
	position: relative;
}

.primary-menu li:hover > .sub-menu,
.primary-menu li:focus-within > .sub-menu {
	display: block;
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 220px;
	background: #1c1030;
	z-index: 30;
}

.primary-menu .sub-menu a {
	padding: 8px 16px;
}

.header-search {
	display: none;
	padding: 0 0 16px;
}

.header-search.is-open {
	display: block;
}

.search-form input[type="search"] {
	width: 100%;
	background: #111;
	border: 1px solid #333;
	color: #fff;
	padding: 12px 14px;
}

.site-main {
	padding-bottom: 28px;
}

.provider-row {
	display: flex;
	align-items: stretch;
	margin-top: 22px;
	background: #161616;
}

.provider-label {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 190px;
	padding: 18px 20px;
	background: var(--accent);
	color: #fff;
	font-weight: 700;
	text-decoration: none;
}

.provider-label::before {
	content: "";
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #fff;
	flex: 0 0 auto;
}

.provider-track {
	display: flex;
	align-items: center;
	overflow: hidden;
	flex: 1;
	min-width: 0;
	padding: 8px 0;
}

.provider-marquee {
	display: flex;
	align-items: center;
	width: max-content;
	flex-shrink: 0;
	animation: provider-marquee-right 40s linear infinite;
}

.provider-set {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 4px;
	padding-right: 4px;
}

@keyframes provider-marquee-right {
	from {
		transform: translateX(-25%);
	}
	to {
		transform: translateX(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.provider-marquee {
		animation: none;
	}
}

.provider-chip {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 168px;
	padding: 8px 10px;
	color: #fff;
	text-decoration: none;
	font-weight: 700;
	flex-shrink: 0;
}

.provider-logo {
	width: 48px;
	height: 48px;
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	font-size: 14px;
	object-fit: cover;
}

.provider-chip:hover .provider-name {
	color: #e4d4ff;
}

.rail {
	margin-top: 28px;
}

.rail-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.rail-title,
.missed-title,
.widget-title {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
}

.rail-title a,
.missed-title,
.widget-title {
	color: #fff;
	text-decoration: none;
	border-bottom: 3px solid var(--accent);
	padding-bottom: 4px;
	display: inline-block;
}

.rail-nav {
	display: flex;
	gap: 6px;
}

.rail-nav button {
	width: 34px;
	height: 34px;
	background: #222;
	color: #fff;
	border: 0;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
}

.rail-nav button:hover {
	background: var(--accent);
}

.rail-track {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 8px;
}

.rail-track > .card {
	flex: 0 0 240px;
	scroll-snap-align: start;
}

.rail-pair {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 28px;
	align-items: stretch;
	margin-top: 28px;
}

.rail-pair > .rail {
	display: flex;
	flex-direction: column;
	margin-top: 0;
	min-width: 0;
	height: 100%;
}

.rail-pair > .rail:not(.is-side) .rail-track {
	flex: 1;
	align-items: stretch;
}

.rail-pair > .rail:not(.is-side) .rail-track > .card {
	flex: 1 1 0;
	width: auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.rail-pair > .rail:not(.is-side) .poster,
.rail-pair > .rail:not(.is-side) .poster.is-cover {
	flex: 1 1 auto;
	min-height: 0;
	height: auto;
	aspect-ratio: auto;
	overflow: hidden;
}

.rail-pair > .rail:not(.is-side) .poster-img {
	width: 100%;
	height: 100%;
	min-height: 0;
	aspect-ratio: auto !important;
	object-fit: cover;
}

.rail.is-side .rail-nav {
	flex-direction: column;
	gap: 4px;
}

.rail.is-side .rail-track {
	flex: 1;
	flex-direction: column;
	gap: 10px;
	max-height: none;
	overflow-x: hidden;
	overflow-y: auto;
	scroll-snap-type: y mandatory;
	padding-bottom: 0;
}

.rail.is-side .rail-track > .card {
	flex: 0 0 auto;
	width: 100%;
	display: flex;
	align-items: center;
	gap: 12px;
	scroll-snap-align: start;
}

.rail.is-side .card-thumb {
	position: relative;
	flex: 0 0 96px;
	width: 96px;
}

.rail.is-side .card-thumb .poster,
.rail.is-side .card-thumb .poster.is-cover {
	width: 96px;
	height: 96px;
	aspect-ratio: 1 / 1;
}

.rail.is-side .card-thumb .poster-img {
	width: 96px;
	height: 96px;
	object-fit: cover;
}

.rail.is-side .card-index {
	top: auto;
	right: auto;
	bottom: 6px;
	left: 6px;
}

.rail.is-side .card-body {
	padding: 8px 10px 8px 0;
	min-width: 0;
}

.rail.is-side .card-title {
	margin: 6px 0 0;
	font-size: 15px;
}

.rail.is-side .rail-track::-webkit-scrollbar {
	width: 0;
	height: 0;
}

.provider-track::-webkit-scrollbar,
.rail-track::-webkit-scrollbar {
	height: 8px;
}

.provider-track::-webkit-scrollbar-thumb,
.rail-track::-webkit-scrollbar-thumb {
	background: #3a3a3a;
}

.card {
	position: relative;
	background: var(--card);
}

.card-index {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	min-width: 26px;
	height: 26px;
	display: grid;
	place-items: center;
	background: var(--accent);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
}

.poster {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	color: #fff;
	text-decoration: none;
}

.poster::before {
	content: "";
	position: absolute;
	width: 140px;
	height: 140px;
	border-radius: 50%;
	right: -30px;
	top: -40px;
	background: rgba(255, 255, 255, 0.08);
	z-index: 1;
}

.poster-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	position: relative;
	z-index: 1;
}

.poster:has(.poster-img)::before {
	content: none;
}

.poster.is-cover,
.feed-post .poster.is-cover {
	aspect-ratio: auto;
	height: auto;
}

.poster.is-cover .poster-img {
	width: 100%;
	height: auto;
	object-fit: cover;
	object-position: center;
}

.poster-mark {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 40px;
	font-weight: 700;
	letter-spacing: 0.06em;
	z-index: 1;
}

.card-body {
	padding: 12px 12px 14px;
}

.cat-badge {
	display: inline-block;
	background: var(--accent);
	color: #fff;
	text-decoration: none;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	padding: 6px 8px;
}

.card-title {
	margin: 8px 0;
	font-size: 16px;
	line-height: 1.35;
}

.card-title a,
.feed-title a,
.read-more {
	color: #fff;
	text-decoration: none;
}

.card-title a:hover,
.feed-title a:hover,
.read-more:hover,
.sidebar a:hover {
	color: #e4d4ff;
}

.entry-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	color: var(--muted);
	font-size: 13px;
}

.card-body .entry-meta {
	font-size: 12px;
}

.entry-meta a {
	color: inherit;
	text-decoration: none;
}

.comment-count {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.comment-count svg {
	width: 14px;
	height: 14px;
}

.layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 40px;
	margin-top: 34px;
	align-items: start;
}

.byline {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.byline svg {
	width: 14px;
	height: 14px;
}

.feed {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 22px 16px;
}

.feed-post {
	min-width: 0;
	padding: 0;
	margin: 0;
	border-bottom: 0;
}

.feed-media {
	position: relative;
	margin-bottom: 10px;
}

.feed-post .poster,
.feed-post .poster.is-cover {
	margin-bottom: 0;
	aspect-ratio: 1 / 1;
	height: auto;
}

.feed-post .poster-img {
	width: 100%;
	height: 100%;
	aspect-ratio: auto !important;
	object-fit: cover;
}

.feed-media .cat-badge {
	position: absolute;
	right: 8px;
	bottom: 8px;
	z-index: 2;
}

.feed-title {
	margin: 8px 0 6px;
	font-size: 16px;
	line-height: 1.35;
}

.feed-post .entry-meta {
	font-size: 12px;
	gap: 8px;
}

.feed-excerpt,
.feed-excerpt p {
	margin: 8px 0;
	color: #c8c8c8;
	font-size: 13px;
	line-height: 1.55;
}

.feed-post .read-more {
	font-size: 13px;
	font-weight: 600;
}

.sidebar {
	position: sticky;
	top: 220px;
}

@media screen and (min-width: 783px) {
	.admin-bar .sidebar {
		top: 252px;
	}
}

.widget {
	margin: 0 0 28px;
}

.sidebar ul {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
}

.sidebar li {
	border-bottom: 1px solid var(--line);
	color: #cfcfcf;
}

.sidebar li a {
	display: block;
	padding: 10px 0;
	color: #fff;
	text-decoration: none;
}

.missed {
	margin-top: 36px;
}

.page-header h1,
.single-title {
	margin: 22px 0 10px;
	font-size: 34px;
	line-height: 1.25;
}

.archive-desc {
	color: #d0d0d0;
	margin-bottom: 8px;
}

.entry-content {
	color: #e8e8e8;
}

.entry-content p,
.entry-content li {
	line-height: 1.8;
}

.entry-content a {
	color: #e6d7ff;
}

.tag-list {
	margin-top: 18px;
}

.tag-list a {
	display: inline-block;
	margin: 0 8px 8px 0;
	padding: 4px 8px;
	background: #1c1c1c;
	color: #fff;
	text-decoration: none;
}

.post-nav {
	margin: 24px 0 8px;
}

.post-navigation {
	display: grid;
	gap: 12px;
}

.post-navigation a {
	color: #fff;
	text-decoration: none;
}

.post-navigation a:hover {
	color: #e4d4ff;
}

.pagination {
	margin: 8px 0 12px;
}

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.pagination .page-numbers {
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	text-decoration: none;
	border: 1px solid #3a3a3a;
	background: #1a1a1a;
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
	background: var(--accent);
	border-color: var(--accent);
}

.gallery-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
	margin: 8px 0 36px;
}

.comments-area {
	margin-top: 28px;
}

.comment-list {
	list-style: none;
	margin: 12px 0 20px;
	padding: 0;
}

.comment-list .comment {
	border-top: 1px solid var(--line);
	padding: 16px 0;
}

.comment-author .fn,
.comment-author .fn a {
	font-weight: 700;
	color: #fff;
	text-decoration: none;
}

.comment-metadata a {
	color: var(--muted);
	text-decoration: none;
	font-size: 13px;
}

.comment-reply-link {
	color: #e6d7ff;
}

.comment-form label {
	display: block;
	margin-bottom: 6px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	background: #161616;
	border: 1px solid #333;
	color: #fff;
	padding: 10px 12px;
}

.comment-form textarea {
	min-height: 140px;
}

.comment-form .form-submit,
.comment-form p {
	margin-top: 12px;
}

.comment-form input[type="submit"] {
	background: var(--accent);
	color: #fff;
	border: 0;
	padding: 10px 16px;
	cursor: pointer;
}

.site-footer {
	background: #0d0d0d;
	text-align: center;
	padding: 28px 16px 36px;
	color: #cfcfcf;
	margin-top: 12px;
}

.site-footer p {
	margin: 0;
}

.age-note {
	margin-top: 8px !important;
	color: #8d8d8d;
	font-size: 13px;
}

@media (max-width: 900px) {
	.layout,
	.gallery-grid {
		grid-template-columns: 1fr 1fr;
	}

	.layout {
		grid-template-columns: 1fr;
	}

	.feed {
		grid-template-columns: 1fr 1fr;
	}

	.sidebar {
		position: static;
	}

	.menu-toggle {
		display: inline-flex;
	}

	.primary-menu {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		flex-direction: column;
		gap: 0;
		background: #14091f;
		padding: 8px 0 12px;
		z-index: 40;
		border-top: 1px solid rgba(255, 255, 255, 0.06);
	}

	.primary-menu.is-open {
		display: flex;
	}

	.primary-menu a {
		padding: 12px 4px;
	}

	.primary-menu .sub-menu,
	.primary-menu li:hover > .sub-menu,
	.primary-menu li:focus-within > .sub-menu {
		position: static;
		display: block;
		background: transparent;
		min-width: 0;
		padding-left: 12px;
	}

	.provider-row {
		flex-direction: column;
	}

	.provider-label {
		min-width: 0;
	}

	.rail-pair {
		grid-template-columns: 1fr;
	}

	.rail-nav {
		display: none;
	}
}

@media (max-width: 640px) {
	.gallery-grid {
		grid-template-columns: 1fr 1fr;
	}

	.feed {
		grid-template-columns: 1fr;
	}

	.brand-heading {
		font-size: 32px;
	}

	.feed-title,
	.page-header h1,
	.single-title {
		font-size: 24px;
	}

	.topbar-inner {
		align-items: flex-start;
		gap: 12px;
	}

	.custom-logo {
		max-height: 56px;
	}

	.brand-desc {
		display: none;
	}

	.social-link {
		width: 38px;
		height: 38px;
	}
}
