@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
	color-scheme: light;
	
	/* Gradient variables */
	--gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #a855f7 25%, #ec4899 50%, #f97316 75%, #ef4444 100%);
	--gradient-text: linear-gradient(135deg, #8b5cf6, #ec4899, #f97316);
	--card-glow: rgba(139, 92, 246, 0.5);
}

.dark {
	color-scheme: dark;
	
	--gradient-primary: linear-gradient(135deg, #a855f7 0%, #ec4899 25%, #f97316 50%, #ef4444 75%, #fb923c 100%);
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	min-height: 100vh;
}

.desc-clamp {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.shimmer {
	background: linear-gradient(
		90deg,
		#f1f5f9 0%,
		#e2e8f0 50%,
		#f1f5f9 100%
	);
	background-size: 200% 100%;
	animation: shimmer 1.4s ease-in-out infinite;
}

.dark .shimmer {
	background: linear-gradient(
		90deg,
		#1e293b 0%,
		#334155 50%,
		#1e293b 100%
	);
}

@keyframes shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* Card hover effect */
.card {
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
	transform: translateY(-2px);
}

img.thumb {
	transition: opacity 0.2s ease;
}

img.thumb:not([src]),
img.thumb[src=""] {
	opacity: 0;
}

#search:focus {
	outline: none;
}

/* ==========================================
   DARK MODE STYLES
   ========================================== */

/* Modal backdrop in dark mode */
dialog#desc-modal::backdrop {
	background: rgba(15, 23, 42, 0.7);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}

.dialog#desc-modal {
	border: none;
	color: inherit;
}

/* Dark mode modal styling */
.dark dialog#desc-modal {
	background-color: #1e293b;
	color: #f1f5f9;
	border-color: #334155;
}

.dark dialog#desc-modal h2,
.dark dialog#desc-modal h3,
.dark dialog#desc-modal h4,
.dark dialog#desc-modal h5,
.dark dialog#desc-modal h6 {
	color: #f1f5f9;
}

.dark dialog#desc-modal p,
.dark dialog#desc-modal li {
	color: #cbd5e1;
}

.dark dialog#desc-modal a {
	color: #8b5cf6;
}

.dark dialog#desc-modal .border-t {
	border-color: #334155;
}

.dark dialog#desc-modal button {
	background-color: #334155;
	color: #f1f5f9;
}

.dark dialog#desc-modal button:hover {
	background-color: #475569;
}

/* Action buttons dark mode */
.dark .action-btn {
	background-color: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.2);
}

.dark .action-btn:hover {
	background-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================
   JOURNAL CARD STYLES
   ========================================== */

.card-3d:focus-visible {
	outline: 2px solid #8b5cf6;
	outline-offset: 2px;
}

.dark .card-3d:focus-visible {
	outline-color: #a78bfa;
}

.card-3d {
	position: relative;
	border-radius: 1rem;
	box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1),
				0 2px 4px -2px rgb(0 0 0 / 0.1);
	transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-3d:hover {
	transform: translateY(-4px);
	box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1),
				0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.card-3d .card-canvas-wrapper {
	position: relative;
	overflow: hidden;
}

.card-3d .thumb {
	transition: opacity 0.3s ease, transform 0.4s ease;
}

.card-3d:hover .thumb {
	transform: scale(1.04);
}

.card-3d .card-content .title {
	font-size: 1rem;
	line-height: 1.4;
}

.card-3d .action-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.card-3d .action-btn:hover {
	transform: scale(1.08);
}

.card-3d .card-glow {
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.card-3d:hover .card-glow {
	opacity: 0.6;
}

/* Dark mode card adjustments */
.dark .card-3d {
	box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3),
				0 2px 4px -2px rgb(0 0 0 / 0.2);
}

.dark .card-3d:hover {
	box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.4),
				0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* ==========================================
   MODAL ANIMATIONS
   ========================================== */

dialog#desc-modal[open] {
	animation: modal-in 0.3s ease-out;
}

@keyframes modal-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ==========================================
   THEME TOGGLE BUTTON
   ========================================== */

#theme-toggle {
	transition: all 0.3s ease;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#theme-toggle:hover {
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
	transform: rotate(15deg);
}

.dark #theme-toggle {
	background-color: #1e293b;
	border-color: #334155;
}

/* ==========================================
   DESC CONTENT STYLING (scoped)
   ========================================== */

/* Deskripsi jurnal dirender sebagai HTML hasil sanitasi (bukan teks polos).
   Semua selector di-scope ke .desc-content agar menang atas preflight Tailwind. */
.desc-content {
	overflow-wrap: break-word;
	word-break: break-word;
	line-height: 1.7;
}

.desc-content > :first-child {
	margin-top: 0;
}

.desc-content > :last-child {
	margin-bottom: 0;
}

.desc-content p,
.desc-content div,
.desc-content ul,
.desc-content ol,
.desc-content dl,
.desc-content blockquote,
.desc-content pre {
	margin: 0 0 1rem;
}

.desc-content h1,
.desc-content h2,
.desc-content h3,
.desc-content h4,
.desc-content h5,
.desc-content h6 {
	margin: 1.5rem 0 0.75rem;
	font-weight: 600;
	line-height: 1.4;
	color: #0f172a;
}

.dark .desc-content h1,
.dark .desc-content h2,
.dark .desc-content h3,
.dark .desc-content h4,
.dark .desc-content h5,
.dark .desc-content h6 {
	color: #f1f5f9;
}

.desc-content h1 { font-size: 1.125rem; }
.desc-content h2 { font-size: 1rem; }
.desc-content h3 { font-size: 0.9375rem; }
.desc-content h4,
.desc-content h5,
.desc-content h6 { font-size: 0.875rem; }

.desc-content strong,
.desc-content b {
	font-weight: 600;
	color: #0f172a;
}

.dark .desc-content strong,
.dark .desc-content b {
	color: #f1f5f9;
}

.desc-content em,
.desc-content i {
	font-style: italic;
}

.desc-content u {
	text-decoration: underline;
}

.desc-content a {
	color: #1d4ed8;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.dark .desc-content a {
	color: #8b5cf6;
}

.desc-content a:hover {
	color: #1e3a8a;
}

.dark .desc-content a:hover {
	color: #a855f7;
}

.desc-content ul,
.desc-content ol {
	padding-left: 1.25rem;
}

.desc-content ul { list-style: disc; }
.desc-content ol { list-style: decimal; }

.desc-content li {
	margin-bottom: 0.25rem;
}

.desc-content img {
	display: inline-block;
	max-width: 100%;
	height: auto;
	margin: 0.25rem 0;
	vertical-align: middle;
}

.desc-content table {
	width: 100%;
	max-width: 100%;
	table-layout: auto;
	border-collapse: collapse;
	margin: 1rem 0;
	font-size: 0.8125rem;
	line-height: 1.5;
}

.desc-content th,
.desc-content td {
	border: 1px solid #e2e8f0;
	padding: 0.5rem 0.75rem;
	text-align: left;
	vertical-align: top;
}

.dark .desc-content th,
.dark .desc-content td {
	border-color: #334155;
}

.desc-content th {
	background: #f8fafc;
	font-weight: 600;
	color: #0f172a;
}

.dark .desc-content th {
	background: #334155;
	color: #f1f5f9;
}

.desc-content caption {
	caption-side: top;
	padding-bottom: 0.5rem;
	font-weight: 600;
	color: #0f172a;
	text-align: left;
}

.dark .desc-content caption {
	color: #f1f5f9;
}

.desc-content blockquote {
	border-left: 3px solid #cbd5e1;
	padding-left: 1rem;
	color: #475569;
	font-style: italic;
}

.dark .desc-content blockquote {
	border-color: #475569;
	color: #94a3b8;
}

.desc-content hr {
	border: 0;
	border-top: 1px solid #e2e8f0;
	margin: 1.5rem 0;
}

.dark .desc-content hr {
	border-color: #334155;
}

.desc-content code,
.desc-content pre {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.8125rem;
	background: #f1f5f9;
	border-radius: 0.375rem;
}

.dark .desc-content code,
.dark .desc-content pre {
	background: #1e293b;
}

.desc-content code {
	padding: 0.125rem 0.375rem;
}

.desc-content pre {
	padding: 0.75rem 1rem;
	overflow-x: auto;
	border-radius: 0.5rem;
}

.desc-content pre code {
	background: none;
	padding: 0;
	border-radius: 0;
}

.desc-content sup,
.desc-content sub {
	font-size: 0.75em;
}

/* ==========================================
   REDUCED MOTION
   ========================================== */
@media (prefers-reduced-motion: reduce) {
	.card-3d, .card-3d *, #counter, #journals-grid, .skeleton-card, .shimmer {
		transition: none !important;
		animation: none !important;
	}
	#journals-grid { perspective: none !important; }
	.card-3d { will-change: auto !important; transform: none !important; }
}

/* ==========================================
   RESPONSIVE TWEAKS
   ========================================== */

@media (max-width: 640px) {
	.card-3d .title {
		font-size: 0.875rem;
	}
	
	.card-3d .card-content {
		padding: 0.75rem;
	}
	
	#theme-toggle {
		width: 2.5rem;
		height: 2.5rem;
	}
}

@media (min-width: 1024px) {
	.grid-cols-xl {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}
