/**
 * Cybersecurity Article — Premium Editorial Stylesheet
 *
 * Dark navy & charcoal palette, refined typography, reading rhythm,
 * polished media embeds, and iPhone Safari viewport & safe-area optimizations.
 *
 * @package Crypto_News
 */

:root {
	/* Palette: Dark Navy & Charcoal */
	--csa-bg-canvas: #070d18;
	--csa-bg-surface: #0c1626;
	--csa-bg-surface-elevated: #112036;
	--csa-bg-card: #152742;
	--csa-bg-card-hover: #1a3052;

	/* Accents: Subtle Precision Blues */
	--csa-accent-blue: #3b82f6;
	--csa-accent-blue-hover: #60a5fa;
	--csa-accent-cyan: #38bdf8;
	--csa-accent-cyan-subtle: rgba(56, 189, 248, 0.12);
	--csa-accent-glow: rgba(59, 130, 246, 0.25);

	/* Typography & Text */
	--csa-text-primary: #f1f5f9;
	--csa-text-secondary: #cbd5e1;
	--csa-text-muted: #8899aa;
	--csa-text-dim: #546577;

	/* Borders & Dividers */
	--csa-border-subtle: rgba(203, 213, 225, 0.08);
	--csa-border-strong: rgba(203, 213, 225, 0.16);
	--csa-border-accent: rgba(59, 130, 246, 0.35);

	/* Fonts */
	--csa-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	--csa-font-serif: 'Newsreader', Georgia, Cambria, "Times New Roman", Times, serif;
	--csa-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	/* Layout Widths */
	--csa-max-prose: 720px;
	--csa-max-wide: 960px;
	--csa-max-hero: 1140px;

	/* Shadows */
	--csa-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
	--csa-shadow-lg: 0 16px 36px -8px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--csa-border-subtle);
}

/* Base resets & containment for article wrapper */
.csa-article-wrapper {
	background-color: var(--csa-bg-canvas);
	color: var(--csa-text-secondary);
	font-family: var(--csa-font-sans);
	font-size: 16px;
	line-height: 1.6;
	min-height: 100vh;
	position: relative;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	-webkit-text-size-adjust: 100%;
	padding-bottom: max(32px, env(safe-area-inset-bottom));
}

/* Override existing theme content container constraints on article template */
.page-template-template-article #primary,
.page-template-template-article .content-area,
.page-template-template-article #content,
.page-template-template-article #content .col-full {
	width: 100% !important;
	max-width: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
	float: none !important;
}

.page-template-template-article #secondary,
.page-template-template-article .widget-area {
	display: none !important;
}

/* Site header, navigation and footer are styled site-wide in site.css. */

/* Reading Progress Bar */
.csa-reading-progress {
	position: fixed;
	top: 0;
	left: 0;
	height: 3px;
	width: 0%;
	background: linear-gradient(90deg, var(--csa-accent-blue), var(--csa-accent-cyan));
	box-shadow: 0 0 10px var(--csa-accent-cyan);
	z-index: 999999;
	transition: width 0.1s linear;
}

/* Article Container */
.csa-article-container {
	margin: 0 auto;
	width: 100%;
}

/* ==========================================================================
   Editorial Header
   ========================================================================== */
.csa-article-header {
	padding: 48px 24px 36px;
	background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, 0.15), transparent 70%),
	            var(--csa-bg-canvas);
	border-bottom: 1px solid var(--csa-border-subtle);
}

.csa-header-inner {
	max-width: var(--csa-max-wide);
	margin: 0 auto;
}

/* Topic Pill */
.csa-topic-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px;
	border-radius: 9999px;
	background: var(--csa-accent-cyan-subtle);
	border: 1px solid rgba(56, 189, 248, 0.25);
	margin-bottom: 20px;
}

.csa-topic-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: var(--csa-accent-cyan);
	box-shadow: 0 0 8px var(--csa-accent-cyan);
	display: inline-block;
}

.csa-topic-text {
	color: var(--csa-accent-cyan);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* Article Headline */
.csa-article-title {
	font-family: var(--csa-font-sans);
	font-size: clamp(28px, 4.5vw, 46px);
	font-weight: 800;
	line-height: 1.18;
	letter-spacing: -0.025em;
	color: var(--csa-text-primary);
	margin: 0 0 18px;
	word-wrap: break-word;
}

/* Subtitle / Deck */
.csa-article-subtitle {
	font-family: var(--csa-font-sans);
	font-size: clamp(17px, 2.2vw, 21px);
	font-weight: 400;
	line-height: 1.5;
	color: var(--csa-text-secondary);
	margin: 0 0 32px;
	max-width: 840px;
}

/* Byline Bar */
.csa-byline-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 24px;
	padding: 18px 22px;
	background: var(--csa-bg-surface);
	border: 1px solid var(--csa-border-subtle);
	border-radius: 10px;
}

.csa-author-lockup {
	display: flex;
	align-items: center;
	gap: 12px;
}

.csa-author-avatar {
	border-radius: 50%;
	width: 44px;
	height: 44px;
	object-fit: cover;
	border: 2px solid var(--csa-border-accent);
}

.csa-author-avatar-placeholder {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--csa-accent-blue), #1e3a8a);
	color: #fff;
	font-weight: 700;
	font-size: 16px;
	border: 2px solid var(--csa-border-accent);
}

.csa-author-details {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.csa-by-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--csa-text-muted);
}

.csa-author-name {
	font-size: 15px;
	font-weight: 600;
	color: var(--csa-text-primary);
	text-decoration: none;
}

.csa-author-name:hover {
	color: var(--csa-accent-blue-hover);
}

.csa-author-title {
	font-size: 12px;
	color: var(--csa-text-muted);
}

.csa-meta-divider {
	width: 1px;
	height: 32px;
	background-color: var(--csa-border-subtle);
}

.csa-dates-lockup {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 12px;
}

.csa-meta-row {
	display: flex;
	gap: 6px;
}

.csa-meta-label {
	color: var(--csa-text-muted);
}

.csa-meta-time {
	color: var(--csa-text-secondary);
	font-weight: 500;
}

.csa-read-time-lockup {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--csa-text-muted);
	font-size: 13px;
	font-weight: 500;
	margin-left: auto;
}

.csa-icon-clock {
	color: var(--csa-accent-cyan);
}

/* ==========================================================================
   Hero Media Section
   ========================================================================== */
.csa-hero-media {
	max-width: var(--csa-max-hero);
	margin: 36px auto 44px;
	padding: 0 20px;
}

.csa-hero-img {
	/* Never crop the hero (editorial artwork often carries text at its edges):
	   cap the height and let the width follow the image's own aspect ratio. */
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 560px;
	margin: 0 auto;
	object-fit: contain;
	border-radius: 12px;
	box-shadow: var(--csa-shadow-lg);
	display: block;
	border: 1px solid var(--csa-border-subtle);
}

.csa-video-container {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: var(--csa-shadow-lg);
	background-color: #000;
	border: 1px solid var(--csa-border-subtle);
}

.csa-video-player {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.csa-media-caption {
	font-size: 13px;
	line-height: 1.5;
	color: var(--csa-text-muted);
	padding: 10px 4px 0;
	font-style: italic;
	text-align: left;
}

/* ==========================================================================
   Article Body & Rich Typography
   ========================================================================== */
.csa-article-body {
	position: relative;
	padding: 0 20px;
}

.csa-body-inner {
	max-width: var(--csa-max-prose);
	margin: 0 auto;
	font-family: var(--csa-font-serif);
	font-size: clamp(18px, 1.35vw, 20px);
	line-height: 1.82;
	color: var(--csa-text-secondary);
}

.csa-body-inner p {
	margin: 0 0 26px;
	color: var(--csa-text-secondary);
	letter-spacing: -0.003em;
}

.csa-body-inner p.lead,
.csa-body-inner > p:first-of-type {
	font-size: 1.15em;
	line-height: 1.7;
	color: var(--csa-text-primary);
	font-weight: 400;
}

/* Headings within Article Body */
.csa-body-inner h2 {
	font-family: var(--csa-font-sans);
	font-size: clamp(24px, 2.6vw, 32px);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.02em;
	color: var(--csa-text-primary);
	margin: 48px 0 18px;
	padding-top: 18px;
	border-top: 1px solid var(--csa-border-subtle);
}

.csa-body-inner h3 {
	font-family: var(--csa-font-sans);
	font-size: clamp(20px, 2.1vw, 25px);
	font-weight: 600;
	line-height: 1.3;
	color: var(--csa-text-primary);
	margin: 36px 0 14px;
}

.csa-body-inner h4 {
	font-family: var(--csa-font-sans);
	font-size: 18px;
	font-weight: 600;
	color: var(--csa-text-primary);
	margin: 28px 0 10px;
}

/* Inline links */
.csa-body-inner a {
	color: var(--csa-accent-cyan);
	text-decoration: underline;
	text-decoration-color: rgba(56, 189, 248, 0.4);
	text-underline-offset: 3px;
	transition: color 0.2s, text-decoration-color 0.2s;
}

.csa-body-inner a:hover {
	color: #fff;
	text-decoration-color: #fff;
}

/* Blockquotes & Pullquotes */
.csa-body-inner blockquote {
	margin: 36px 0;
	padding: 22px 28px;
	background: var(--csa-bg-surface);
	border-left: 4px solid var(--csa-accent-blue);
	border-radius: 0 10px 10px 0;
	font-style: italic;
	color: var(--csa-text-primary);
	font-size: 1.1em;
	line-height: 1.65;
	box-shadow: var(--csa-shadow-sm);
}

.csa-body-inner blockquote p:last-child {
	margin-bottom: 0;
}

/* Callout Box / Key Takeaway */
.csa-callout,
.csa-body-inner .csa-key-takeaway {
	margin: 36px 0;
	padding: 24px;
	background: var(--csa-bg-surface-elevated);
	border: 1px solid var(--csa-border-accent);
	border-radius: 12px;
	box-shadow: var(--csa-shadow-sm);
	font-family: var(--csa-font-sans);
	font-size: 15px;
	line-height: 1.6;
}

.csa-callout h4,
.csa-key-takeaway-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--csa-accent-cyan);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 0 0 10px;
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Lists */
.csa-body-inner ul,
.csa-body-inner ol {
	margin: 0 0 26px;
	padding-left: 28px;
}

.csa-body-inner li {
	margin-bottom: 10px;
	line-height: 1.7;
}

.csa-body-inner ul > li::marker {
	color: var(--csa-accent-blue);
}

/* Code & Tech snippets */
.csa-body-inner code {
	font-family: var(--csa-font-mono);
	font-size: 0.88em;
	background: rgba(0, 0, 0, 0.4);
	color: var(--csa-accent-cyan);
	padding: 2px 7px;
	border-radius: 4px;
	border: 1px solid var(--csa-border-subtle);
}

.csa-body-inner pre {
	background: #040810;
	border: 1px solid var(--csa-border-strong);
	border-radius: 8px;
	padding: 18px 22px;
	overflow-x: auto;
	margin: 28px 0;
}

.csa-body-inner pre code {
	background: transparent;
	border: none;
	padding: 0;
	font-size: 14px;
	line-height: 1.6;
	color: #e2e8f0;
}

/* Figures & In-Article Images */
.csa-body-inner figure {
	margin: 36px 0;
}

.csa-body-inner figure img {
	width: 100%;
	height: auto;
	border-radius: 10px;
	border: 1px solid var(--csa-border-subtle);
	box-shadow: var(--csa-shadow-sm);
	display: block;
}

.csa-body-inner figcaption {
	font-family: var(--csa-font-sans);
	font-size: 13px;
	line-height: 1.5;
	color: var(--csa-text-muted);
	padding-top: 8px;
	font-style: italic;
	text-align: center;
}

/* Wide image bleed inside prose */
.csa-body-inner figure.alignwide {
	margin-left: calc(-1 * (min(100vw, var(--csa-max-wide)) - var(--csa-max-prose)) / 2);
	margin-right: calc(-1 * (min(100vw, var(--csa-max-wide)) - var(--csa-max-prose)) / 2);
	max-width: var(--csa-max-wide);
}

/* End Sentinel */
.csa-article-end {
	width: 100%;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

/* ==========================================================================
   Article Editorial Footer
   ========================================================================== */
.csa-article-footer {
	max-width: var(--csa-max-prose);
	margin: 48px auto 60px;
	padding: 0 20px;
}

.csa-footer-card {
	background: var(--csa-bg-surface);
	border: 1px solid var(--csa-border-subtle);
	border-radius: 12px;
	padding: 28px;
}

.csa-footer-author {
	display: flex;
	gap: 18px;
	align-items: flex-start;
	padding-bottom: 22px;
	border-bottom: 1px solid var(--csa-border-subtle);
}

.csa-footer-avatar {
	border-radius: 50%;
	width: 60px;
	height: 60px;
	object-fit: cover;
	flex-shrink: 0;
	border: 2px solid var(--csa-border-accent);
}

.csa-footer-author-text {
	flex: 1;
}

.csa-footer-author-name {
	font-size: 18px;
	font-weight: 700;
	color: var(--csa-text-primary);
	margin: 0 0 6px;
}

.csa-footer-author-bio {
	font-size: 14px;
	line-height: 1.55;
	color: var(--csa-text-muted);
	margin: 0;
}

.csa-editorial-disclosure {
	padding-top: 18px;
	font-size: 12px;
	line-height: 1.6;
	color: var(--csa-text-dim);
}

.csa-editorial-disclosure p {
	margin: 0;
}

.csa-editorial-disclosure strong {
	color: var(--csa-text-muted);
}

.csa-footer-consent-trigger {
	padding-top: 18px;
	border-top: 1px solid var(--csa-border-subtle);
	margin-top: 18px;
}

/* .csa-manage-consent-btn, .csa-consent-banner and .csa-btn live in consent.css (loaded site-wide). */

/* ==========================================================================
   iPhone Safari & Mobile Responsive Adjustments
   ========================================================================== */
@media (max-width: 768px) {
	.csa-article-header {
		padding: 28px 16px 24px;
	}

	.csa-article-title {
		font-size: 26px;
		line-height: 1.22;
	}

	.csa-article-subtitle {
		font-size: 16px;
		margin-bottom: 22px;
	}

	.csa-byline-bar {
		padding: 14px 16px;
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.csa-meta-divider {
		display: none;
	}

	.csa-read-time-lockup {
		margin-left: 0;
	}

	.csa-hero-media {
		margin: 24px auto 30px;
		padding: 0 16px;
	}

	.csa-hero-img,
	.csa-video-container {
		border-radius: 8px;
	}

	.csa-article-body {
		padding: 0 16px;
	}

	.csa-body-inner {
		font-size: 17px;
		line-height: 1.76;
	}

	.csa-body-inner h2 {
		font-size: 22px;
		margin: 36px 0 14px;
	}

	.csa-body-inner h3 {
		font-size: 19px;
	}

	.csa-body-inner blockquote {
		padding: 16px 20px;
		margin: 26px 0;
		font-size: 1.05em;
	}

	.csa-footer-author {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

}

/* Print Styles */
@media print {
	.csa-reading-progress,
	.csa-consent-banner,
	.csa-hero-video-wrap {
		display: none !important;
	}

	.csa-article-wrapper {
		background: #fff !important;
		color: #111 !important;
	}

	.csa-article-title,
	.csa-body-inner h2,
	.csa-body-inner h3 {
		color: #000 !important;
	}

	.csa-body-inner a {
		color: #000 !important;
		text-decoration: underline !important;
	}
}


/* --------------------------------------------------------------------------
   Looping in-article video clips (video-loop.js: plays only while on screen)
   ----------------------------------------------------------------------- */
.csa-body-inner .wp-block-video {
	position: relative;
	margin: 36px 0 40px;
}

.csa-body-inner .wp-block-video video {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: 12px;
	background: #070d18;
	box-shadow: 0 14px 34px -14px rgba(15, 23, 42, 0.45);
}

@media (max-width: 768px) {
	.csa-body-inner .wp-block-video {
		margin: 28px 0 32px;
	}
	.csa-body-inner .wp-block-video video {
		border-radius: 8px;
	}
}

/* --------------------------------------------------------------------------
   Animated section images (Image block with class "csa-anim-image")
   Slow zoom drift + pulsing red glow + periodic light sheen, all looping.
   Transform/opacity only; paused while off-screen (video-loop.js);
   static for prefers-reduced-motion.
   ----------------------------------------------------------------------- */
.csa-body-inner .wp-block-image.csa-anim-image {
	position: relative;
	margin: 32px 0 36px;
	border-radius: 12px;
	overflow: hidden;
	isolation: isolate;
	box-shadow: 0 14px 34px -14px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(239, 68, 68, 0.22);
}

.csa-body-inner .csa-anim-image img {
	display: block;
	width: 100%;
	height: auto;
	/* Centred, max 1.04: at most ~1.9% trimmed per edge, so logos/headlines near the edges stay intact. */
	transform-origin: 50% 50%;
}

@media (prefers-reduced-motion: no-preference) {
	.csa-body-inner .wp-block-image.csa-anim-image {
		animation: csa-anim-glow 3.4s ease-in-out infinite;
	}

	.csa-body-inner .csa-anim-image img {
		animation: csa-anim-drift 16s ease-in-out infinite alternate;
		will-change: transform;
	}

	.csa-body-inner .csa-anim-image::after {
		content: '';
		position: absolute;
		inset: 0;
		z-index: 1;
		pointer-events: none;
		background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.16) 50%, transparent 62%);
		transform: translateX(-130%);
		animation: csa-anim-sheen 6.5s ease-in-out infinite;
	}

	.csa-body-inner .csa-anim-image.is-offscreen,
	.csa-body-inner .csa-anim-image.is-offscreen img,
	.csa-body-inner .csa-anim-image.is-offscreen::after {
		animation-play-state: paused;
	}
}

@keyframes csa-anim-drift {
	from { transform: scale(1) translate(0, 0); }
	to   { transform: scale(1.04); }
}

@keyframes csa-anim-glow {
	0%, 100% { box-shadow: 0 14px 34px -14px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(239, 68, 68, 0.22); }
	50%      { box-shadow: 0 14px 34px -14px rgba(15, 23, 42, 0.45), 0 0 26px 2px rgba(239, 68, 68, 0.45); }
}

@keyframes csa-anim-sheen {
	0%, 55%   { transform: translateX(-130%); }
	85%, 100% { transform: translateX(130%); }
}

@media (max-width: 768px) {
	.csa-body-inner .wp-block-image.csa-anim-image {
		margin: 26px 0 30px;
		border-radius: 8px;
	}
}

/* "Recover" variant (csa-anim-image--recover): the glow shifts from alert red to
   secure teal and back — compromise → protected, matching the checklist artwork. */
.csa-body-inner .wp-block-image.csa-anim-image--recover {
	box-shadow: 0 14px 34px -14px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(20, 184, 166, 0.25);
}

@media (prefers-reduced-motion: no-preference) {
	.csa-body-inner .wp-block-image.csa-anim-image--recover {
		animation: csa-anim-glow-recover 6s ease-in-out infinite;
	}

	/* The shorthand above resets play-state; keep the off-screen pause for this variant. */
	.csa-body-inner .wp-block-image.csa-anim-image--recover.is-offscreen {
		animation-play-state: paused;
	}
}

@keyframes csa-anim-glow-recover {
	0%, 100% { box-shadow: 0 14px 34px -14px rgba(15, 23, 42, 0.45), 0 0 24px 2px rgba(239, 68, 68, 0.42); }
	50%      { box-shadow: 0 14px 34px -14px rgba(15, 23, 42, 0.45), 0 0 26px 3px rgba(20, 184, 166, 0.5); }
}
