/**
 * Keystone Single Article Page Stylesheet (Octopus Luxury Architecture)
 * High UX, SEO-optimized typography, floating share bar, collapsible TOC,
 * key takeaway callout, FAQ accordion, author dossier, and related monographs.
 *
 * @package Keystone
 * @since 1.5.5
 */

/* 1. Page Wrap & Ambient Lighting */
body.single-post,
body.single-post #page,
body.single-post .site-content {
	background-color: #06090E !important;
	overflow-x: clip !important;
}

.ks-single-article-page {
	position: relative;
	background-color: #06090E !important;
	color: #E2E8F0 !important;
	min-height: 100vh;
	padding-top: calc(var(--ks-header-h, 72px) + 52px) !important;
	padding-bottom: 96px;
	overflow: visible !important;
	overflow-x: visible !important;
}

.ks-single-article-page .ks-breadcrumbs {
	margin: 32px auto 36px !important;
	width: fit-content;
}

.ks-article-ambient-glow {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	max-width: 1400px;
	height: 600px;
	background: radial-gradient(circle at 50% 10%, rgba(200, 138, 53, 0.08) 0%, rgba(10, 13, 20, 0) 70%);
	pointer-events: none;
	z-index: 0;
}

/* 2. Article Hero & Header */
.ks-article-hero-wrap {
	position: relative;
	z-index: 1;
	max-width: 860px;
	margin: 0 auto 36px;
	text-align: center;
}

.ks-article-category-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: rgba(200, 138, 53, 0.12);
	border: 1px solid rgba(200, 138, 53, 0.35);
	color: var(--ks-accent, #C88A35);
	padding: 6px 16px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.03em;
	margin-bottom: 20px;
}

.ks-article-category-badge .ks-badge-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background-color: var(--ks-accent, #C88A35);
	box-shadow: 0 0 10px var(--ks-accent, #C88A35);
	animation: ks-pulse-dot 2s infinite ease-in-out;
}

@keyframes ks-pulse-dot {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.4; transform: scale(0.85); }
}

.ks-article-hero-title {
	font-size: clamp(1.85rem, 3.4vw, 2.75rem);
	line-height: 1.3;
	font-weight: 800;
	color: #FFFFFF !important;
	margin: 0 0 18px;
	text-wrap: balance;
	text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.ks-article-hero-lead {
	font-size: clamp(1.05rem, 1.4vw, 1.2rem);
	line-height: 1.75;
	color: #CBD5E1 !important;
	margin: 0 auto 28px;
	max-width: 780px;
}

/* Author & Meta Row */
.ks-article-meta-dossier {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 18px;
	background: rgba(22, 27, 34, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.08);
	padding: 10px 22px;
	border-radius: 999px;
	font-size: 13px;
	color: #CBD5E1;
	backdrop-filter: blur(12px);
}

.ks-meta-author-cluster {
	display: flex;
	align-items: center;
	gap: 10px;
}

.ks-meta-author-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
	border: 1.5px solid var(--ks-accent, #C88A35);
}

.ks-meta-author-name {
	font-weight: 700;
	color: #FFFFFF;
}

.ks-meta-sep {
	color: rgba(255, 255, 255, 0.2);
}

.ks-meta-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #94A3B8;
}

/* 3. Featured Image Frame */
.ks-article-featured-media {
	position: relative;
	z-index: 1;
	max-width: 900px;
	margin: 0 auto 48px;
	border-radius: 18px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.1);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	background-color: #161B22;
	aspect-ratio: 16 / 9;
}

.ks-article-featured-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ks-article-featured-media:hover img {
	transform: scale(1.02);
}

/* 4. Reading Grid with Sticky Social Share Bar */
.ks-article-layout-grid {
	position: relative;
	max-width: 1060px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: 56px 1fr;
	gap: 36px;
	align-items: stretch;
}

.ks-share-col {
	position: relative;
	height: 100%;
}

/* Sticky Share Bar */
.ks-floating-share-bar {
	position: sticky !important;
	top: calc(var(--ks-header-h, 72px) + 36px) !important;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	z-index: 50;
	align-self: start !important;
}

@media (max-width: 1024px) {
	.ks-article-layout-grid {
		grid-template-columns: 1fr;
		gap: 24px;
	}
	.ks-share-col {
		height: auto;
	}
	.ks-floating-share-bar {
		position: static !important;
		flex-direction: row;
		justify-content: center;
		margin-bottom: 24px;
	}
}

.ks-share-btn {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(22, 27, 34, 0.85);
	border: 1px solid rgba(255, 255, 255, 0.12);
	color: #94A3B8;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.25s ease;
	text-decoration: none;
	cursor: pointer;
	backdrop-filter: blur(8px);
	position: relative;
}

.ks-share-btn:hover {
	background: var(--ks-accent, #C88A35);
	color: #0A0D14;
	border-color: var(--ks-accent, #C88A35);
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(200, 138, 53, 0.35);
}

.ks-share-btn svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* Toast Copy Link Notification */
.ks-share-toast {
	position: fixed;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%) translateY(30px);
	background: var(--ks-accent, #C88A35);
	color: #0A0D14;
	font-weight: 700;
	padding: 10px 24px;
	border-radius: 999px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
	font-size: 14px;
	opacity: 0;
	pointer-events: none;
	transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	z-index: 9999;
}

.ks-share-toast.is-active {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* 5. Main Content Column */
.ks-article-main-body {
	max-width: 840px;
	font-size: 1.08rem;
	line-height: 1.88;
	color: #CBD5E1;
}

/* Table of Contents Card */
.ks-toc-card {
	background: rgba(22, 27, 34, 0.7);
	border: 1px solid rgba(200, 138, 53, 0.28);
	border-radius: 14px;
	padding: 22px 26px;
	margin-bottom: 36px;
	backdrop-filter: blur(10px);
}

.ks-toc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	user-select: none;
}

.ks-toc-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 1.15rem;
	font-weight: 700;
	color: #FFFFFF;
	margin: 0;
}

.ks-toc-toggle-btn {
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: #94A3B8;
	width: 30px;
	height: 30px;
	border-radius: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;
}

.ks-toc-toggle-btn:hover {
	background: var(--ks-accent, #C88A35);
	color: #0A0D14;
}

.ks-toc-list {
	list-style: none;
	padding: 0;
	margin: 18px 0 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	padding-top: 16px;
}

.ks-toc-item a {
	color: #94A3B8;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	transition: color 0.2s ease, transform 0.2s ease;
}

.ks-toc-item a:hover,
.ks-toc-item.is-active a {
	color: var(--ks-accent, #C88A35);
	transform: translateX(4px);
}

[dir="rtl"] .ks-toc-item a:hover,
[dir="rtl"] .ks-toc-item.is-active a {
	transform: translateX(-4px);
}

/* Key Takeaways Callout */
.ks-takeaways-card {
	background: linear-gradient(135deg, rgba(200, 138, 53, 0.08) 0%, rgba(22, 27, 34, 0.7) 100%);
	border: 1px solid rgba(200, 138, 53, 0.4);
	border-radius: 14px;
	padding: 24px 28px;
	margin-bottom: 40px;
	position: relative;
	overflow: hidden;
}

.ks-takeaways-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--ks-accent, #C88A35), transparent);
}

.ks-takeaways-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 1.15rem;
	font-weight: 700;
	color: #FFFFFF;
	margin: 0 0 16px;
}

.ks-takeaways-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ks-takeaways-list li {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	font-size: 15px;
	line-height: 1.7;
	color: #E2E8F0;
}

.ks-takeaway-bullet {
	color: var(--ks-accent, #C88A35);
	font-size: 14px;
	line-height: 1.7;
	flex-shrink: 0;
}

/* Article Typography (Headings & Paragraphs) */
.ks-article-main-body h2 {
	font-size: clamp(1.4rem, 2.2vw, 1.75rem);
	line-height: 1.35;
	font-weight: 800;
	color: #FFFFFF;
	margin-top: 48px;
	margin-bottom: 20px;
	padding-inline-start: 16px;
	border-inline-start: 4px solid var(--ks-accent, #C88A35);
	scroll-margin-top: 110px;
}

.ks-article-main-body p {
	margin-bottom: 22px;
}

.ks-article-main-body strong {
	color: #FFFFFF;
	font-weight: 700;
}

/* Styled Lists */
.ks-article-styled-list {
	list-style: none;
	padding: 0;
	margin: 0 0 28px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.ks-article-styled-list li {
	position: relative;
	padding-inline-start: 22px;
	font-size: 1.02rem;
	line-height: 1.75;
}

.ks-article-styled-list li::before {
	content: '';
	position: absolute;
	inset-inline-start: 0;
	top: 11px;
	width: 7px;
	height: 7px;
	border-radius: 2px;
	background-color: var(--ks-accent, #C88A35);
}

/* Highlight Box */
.ks-article-highlight-box {
	background: rgba(22, 27, 34, 0.65);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
	padding: 24px;
	margin: 28px 0;
}

.ks-highlight-title {
	font-weight: 700;
	color: #FFFFFF;
	font-size: 1.05rem;
	margin-bottom: 16px;
}

/* Quotes */
.ks-article-quote {
	margin: 36px 0;
	padding: 24px 28px;
	background: rgba(200, 138, 53, 0.05);
	border-inline-start: 4px solid var(--ks-accent, #C88A35);
	border-radius: 0 12px 12px 0;
	font-size: 1.15rem;
	font-style: italic;
	color: #F1F5F9;
	line-height: 1.8;
}

[dir="rtl"] .ks-article-quote {
	border-radius: 12px 0 0 12px;
}

.ks-article-quote cite {
	display: block;
	font-size: 0.9rem;
	font-style: normal;
	color: var(--ks-accent, #C88A35);
	margin-top: 10px;
	font-weight: 600;
}

/* Steps Grid */
.ks-article-steps-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
	gap: 18px;
	margin: 30px 0;
}

.ks-step-card {
	background: rgba(22, 27, 34, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
	padding: 22px;
	transition: border-color 0.25s ease;
}

.ks-step-card:hover {
	border-color: rgba(200, 138, 53, 0.4);
}

.ks-step-num {
	display: inline-block;
	font-size: 1.5rem;
	font-weight: 900;
	color: var(--ks-accent, #C88A35);
	margin-bottom: 10px;
}

.ks-step-title {
	font-size: 1.05rem;
	font-weight: 700;
	color: #FFFFFF;
	margin: 0 0 8px;
}

.ks-step-text {
	font-size: 0.92rem;
	line-height: 1.65;
	color: #94A3B8;
	margin: 0;
}

/* Responsive Table */
.ks-article-table-wrap {
	overflow-x: auto;
	margin: 30px 0;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.ks-article-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
	text-align: start;
	background: rgba(22, 27, 34, 0.6);
}

.ks-article-table th {
	background: rgba(22, 27, 34, 0.95);
	color: #FFFFFF;
	font-weight: 700;
	padding: 14px 18px;
	border-bottom: 2px solid rgba(200, 138, 53, 0.4);
}

.ks-article-table td {
	padding: 14px 18px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	color: #CBD5E1;
}

.ks-article-table tr:hover td {
	background: rgba(255, 255, 255, 0.02);
}

/* 6. FAQ Accordion Section */
.ks-article-faq-section {
	margin-top: 56px;
	padding-top: 36px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ks-faq-accordion-group {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: 24px;
}

.ks-faq-item {
	background: rgba(18, 24, 36, 0.75);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 14px;
	overflow: hidden;
	transition: all 0.3s ease;
}

.ks-faq-item:hover {
	border-color: rgba(197, 168, 128, 0.35);
}

.ks-faq-item.is-open {
	background: linear-gradient(160deg, rgba(26, 34, 48, 0.9) 0%, rgba(14, 19, 30, 0.98) 100%) !important;
	border-color: rgba(197, 168, 128, 0.5) !important;
	box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ks-faq-trigger,
.ks-faq-trigger:hover,
.ks-faq-trigger:focus,
.ks-faq-trigger:active,
.ks-faq-item.is-open .ks-faq-trigger,
button.ks-faq-trigger,
button.ks-faq-trigger:hover,
button.ks-faq-trigger:focus,
button.ks-faq-trigger:active,
button.ks-faq-trigger:focus-visible {
	width: 100%;
	background: transparent !important;
	background-color: transparent !important;
	outline: none !important;
	box-shadow: none !important;
	border: none !important;
	padding: 20px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-align: start;
	cursor: pointer;
	color: #FFFFFF !important;
	font-size: 1.05rem;
	font-weight: 700;
	font-family: inherit;
	gap: 16px;
	transition: color 0.2s ease;
}

.ks-faq-item.is-open .ks-faq-trigger {
	color: #C5A880 !important;
}

.ks-faq-icon {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(197, 168, 128, 0.1);
	border: 1px solid rgba(197, 168, 128, 0.25);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #C5A880;
	flex-shrink: 0;
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, border-color 0.3s ease;
	font-size: 20px;
	line-height: 1;
}

.ks-faq-item.is-open .ks-faq-icon {
	transform: rotate(45deg);
	background: #C5A880 !important;
	color: #080C14 !important;
	border-color: #C5A880 !important;
}

.ks-faq-answer {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	padding: 0 24px;
}

.ks-faq-item.is-open .ks-faq-answer {
	max-height: 500px;
	padding: 0 24px 22px;
}

.ks-faq-answer p {
	margin: 0;
	font-size: 0.98rem;
	line-height: 1.8;
	color: #CBD5E1;
	border-top: 1px dashed rgba(197, 168, 128, 0.2);
	padding-top: 16px;
}

/* 7. Author Bio Dossier Card */
.ks-author-dossier-card {
	margin-top: 56px;
	background: rgba(22, 27, 34, 0.8);
	border: 1px solid rgba(200, 138, 53, 0.3);
	border-radius: 16px;
	padding: 28px;
	display: flex;
	align-items: center;
	gap: 24px;
	backdrop-filter: blur(12px);
}

@media (max-width: 680px) {
	.ks-author-dossier-card {
		flex-direction: column;
		text-align: center;
	}
}

.ks-author-dossier-avatar {
	width: 90px;
	height: 90px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--ks-accent, #C88A35);
	flex-shrink: 0;
	box-shadow: 0 0 20px rgba(200, 138, 53, 0.2);
}

.ks-author-dossier-info {
	flex: 1;
}

.ks-author-dossier-label {
	font-size: 12px;
	color: var(--ks-accent, #C88A35);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 700;
	margin-bottom: 4px;
}

.ks-author-dossier-name {
	font-size: 1.3rem;
	font-weight: 800;
	color: #FFFFFF;
	margin: 0 0 4px;
}

.ks-author-dossier-creds {
	font-size: 0.88rem;
	color: #94A3B8;
	margin-bottom: 10px;
}

.ks-author-dossier-bio {
	font-size: 0.95rem;
	line-height: 1.65;
	color: #CBD5E1;
	margin: 0;
}

/* 8. Bottom Engineering Project CTA */
.ks-article-cta-box {
	margin-top: 56px;
	background: linear-gradient(135deg, rgba(200, 138, 53, 0.15) 0%, rgba(22, 27, 34, 0.9) 100%);
	border: 1px solid rgba(200, 138, 53, 0.4);
	border-radius: 18px;
	padding: 36px 32px;
	text-align: center;
	position: relative;
	overflow: hidden;
}

.ks-article-cta-title {
	font-size: clamp(1.4rem, 2.2vw, 1.8rem);
	font-weight: 800;
	color: #FFFFFF;
	margin: 0 0 12px;
}

.ks-article-cta-desc {
	font-size: 1.05rem;
	line-height: 1.7;
	color: #CBD5E1;
	max-width: 640px;
	margin: 0 auto 24px;
}

.ks-article-cta-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 14px;
}

/* 9. Related Articles Section */
.ks-related-articles-section {
	max-width: 1200px;
	margin: 80px auto 0;
	padding-top: 56px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ks-related-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	margin-bottom: 32px;
	flex-wrap: wrap;
	gap: 16px;
}

.ks-related-title {
	font-size: clamp(1.5rem, 2.4vw, 2rem);
	font-weight: 800;
	color: #FFFFFF;
	margin: 0;
}

.ks-related-subhead {
	font-size: 0.95rem;
	color: #94A3B8;
	margin-top: 4px;
}

.ks-related-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

@media (max-width: 900px) {
	.ks-related-grid {
		grid-template-columns: 1fr;
	}
}
