/* Hand-written CSS ported from app/globals.css (everything below its
   @theme block — the @theme tokens themselves are compiled into
   tailwind.css, see import-scripts/build-css.sh). */

html {
	scroll-behavior: smooth;
}

body {
	background-color: #fff;
	color: #19191a;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* ---- Animations ---- */
@keyframes fade-up {
	from { opacity: 0; transform: translateY(24px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.reveal {
	opacity: 0;
}

.reveal.is-visible {
	animation: fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
	animation-delay: var(--reveal-delay, 0ms);
}

@keyframes rise {
	from { transform: translateY(24px); }
	to { transform: translateY(0); }
}
.animate-fade-up {
	animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
	animation-delay: var(--reveal-delay, 0ms);
}

@keyframes marquee {
	from { transform: translateX(0); }
	to   { transform: translateX(-50%); }
}
.animate-marquee {
	animation: marquee 28s linear infinite;
}
.animate-marquee:hover {
	animation-play-state: paused;
}

.safe-top  { padding-top: env(safe-area-inset-top); }
.pb-safe   { padding-bottom: env(safe-area-inset-bottom); }
.safe-x    { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.reveal,
	.reveal.is-visible,
	.animate-fade-up {
		animation: none !important;
		opacity: 1 !important;
		transform: none !important;
	}
}

/* ---- Editor content typography (posts/pages rendered via the_content()) ----
   Fixes from feedback/Feedback site remote & authen.pdf: headings weren't
   styled, blockquote had no design, paragraphs were too tight, tables had no
   borders. Scoped to .prose (see index.php's content wrapper). */
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
	color: #007ce2;
	font-weight: 700;
	line-height: 1.25;
	margin-top: 1.5em;
	margin-bottom: 0.6em;
}
.prose h1 { font-size: 3em; color: #3d7de3; }
.prose h2 { font-size: 1.875em; }
.prose h3 { font-size: 1.5em; }
.prose h4 { font-size: 1.25em; }
.prose h5 { font-size: 1.1em; }
.prose h6 { font-size: 1em; }

.prose p,
.prose li {
	line-height: 1.6;
}

.prose p {
	margin-top: 1em;
	margin-bottom: 1em;
}

/* Tailwind's Preflight reset strips default list markers — restore them. */
.prose ul {
	list-style: disc;
	margin: 1em 0;
	padding-left: 1.5em;
}
.prose ol {
	list-style: decimal;
	margin: 1em 0;
	padding-left: 1.5em;
}
.prose li {
	margin: 0.35em 0;
}
.prose li > ul,
.prose li > ol {
	margin: 0.35em 0;
}

.prose blockquote {
	margin: 1.5em 0;
	padding: 0.75em 1.25em;
	border-left: 4px solid #367fee;
	background: #eef5fe;
	color: #1c3354;
	font-style: italic;
	border-radius: 0 0.5rem 0.5rem 0;
}
.prose blockquote p {
	margin: 0;
}

.prose table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.5em 0;
}
.prose th,
.prose td {
	border: 1px solid #e2e8f0;
	padding: 0.5em 0.75em;
	text-align: left;
}
.prose th {
	background: #f8fafc;
	font-weight: 600;
}

/* ---- Blog index pagination (home.php, the_posts_pagination()) ---- */
.aa-pagination .nav-links {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.aa-pagination .page-numbers {
	display: inline-flex;
	min-width: 2.25rem;
	height: 2.25rem;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	border: 1px solid #e2e8f0;
	padding: 0 0.75rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: #475569;
	transition: all 0.15s ease;
}
.aa-pagination .page-numbers:hover {
	border-color: #85b5f4;
	color: #2860bd;
}
.aa-pagination .page-numbers.current {
	background: #367fee;
	border-color: #367fee;
	color: #fff;
}
.aa-pagination .page-numbers.dots {
	border: none;
}

/* ---- Post content: keep wide blocks inside the viewport on mobile ----
   Fix from feedback/Fix UX_UI website 7_9.docx §"Bản mobile fit với khung
   hiển thị": a 4-column table inside an imported article is wider than a
   phone screen, and since nothing clipped it the whole document box grew
   past the viewport — text ended up wrapping at ~half the screen width and
   images ran off the right edge. Tables now scroll inside their own box
   (wrapper added by aa_wrap_content_tables() in inc/editor-enhancements.php)
   instead of stretching the page. */
.aa-table-scroll {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.aa-table-scroll > table {
	margin: 0;
	/* Narrower than this and 4-column tables become unreadable one-word-per-
	   line columns; the wrapper scrolls instead. */
	min-width: 34rem;
}
.prose img,
.prose iframe,
.prose video {
	max-width: 100%;
	height: auto;
}
/* WordPress caption markup ([caption] / the image block with a caption)
   carries the original image width as an inline style — `width: 800px` on
   the <figure> itself. The image inside scales down, but the figure box
   doesn't, so on a phone it alone pushed the document to ~816px wide and
   everything else wrapped to match. max-width wins over the inline width
   without needing !important. */
.prose figure,
.prose .wp-caption {
	max-width: 100%;
}
.prose figure img,
.prose .wp-caption img {
	margin-left: auto;
	margin-right: auto;
}
.prose pre {
	max-width: 100%;
	overflow-x: auto;
}
/* Long unbroken strings (URLs, secret keys) are common in this content. */
.prose p,
.prose li,
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
	overflow-wrap: break-word;
}

/* ---- Content + sidebar layout (single.php, archive.php, search.php) ---- */
.aa-with-sidebar {
	display: grid;
	gap: 2.5rem;
	align-items: start;
	grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1024px) {
	.aa-with-sidebar {
		grid-template-columns: minmax(0, 1fr) 20rem;
		gap: 3rem;
	}
}

.aa-sidebar {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	min-width: 0;
}
@media (min-width: 1024px) {
	.aa-sidebar {
		position: sticky;
		/* Clears the sticky 4rem header. */
		top: 5rem;
	}
}

.aa-widget {
	border: 1px solid #e2e8f0;
	border-radius: 1rem;
	background: #fff;
	padding: 1.25rem;
}
.aa-widget-title {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	margin-bottom: 0.5rem;
	font-size: 1.125rem;
	font-weight: 700;
	color: #001b38;
}
.aa-widget-title svg {
	height: 1.05rem;
	width: 1.05rem;
	flex: none;
	color: #367fee;
}
.aa-widget-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.aa-widget-list li + li {
	border-top: 1px solid #f1f5f9;
}
.aa-widget-list a {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	padding: 0.7rem 0;
	font-size: 0.9rem;
	line-height: 1.45;
	color: #1e293b;
	transition: color 0.15s ease;
}
.aa-widget-list a:hover {
	color: #2860bd;
}
.aa-widget-list a svg {
	margin-top: 0.2rem;
	height: 0.8rem;
	width: 0.8rem;
	flex: none;
	color: #367fee;
}
.aa-widget-list .aa-widget-count {
	margin-left: auto;
	padding-left: 0.5rem;
	font-size: 0.75rem;
	color: #94a3b8;
}

/* ---- Search form (searchform.php) ---- */
.aa-searchform {
	display: flex;
	align-items: stretch;
	overflow: hidden;
	border: 1px solid #e2e8f0;
	border-radius: 0.75rem;
	background: #f8fafc;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}
.aa-searchform:focus-within {
	border-color: #85b5f4;
	background: #fff;
}
.aa-searchform input[type="search"] {
	min-width: 0;
	flex: 1;
	border: 0;
	background: transparent;
	padding: 0.7rem 0.9rem;
	font-size: 0.9rem;
	color: #0f172a;
	outline: none;
}
.aa-searchform input[type="search"]::placeholder {
	color: #94a3b8;
}
.aa-searchform button {
	display: flex;
	flex: none;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	border: 0;
	background: #d8e8fc;
	padding: 0 1.1rem;
	color: #2860bd;
	transition: background-color 0.15s ease;
}
.aa-searchform button:hover {
	background: #b6d3f9;
}
.aa-searchform button svg {
	height: 1.15rem;
	width: 1.15rem;
}

/* Wide variant used at the top of the blog/archive listings. */
.aa-searchform--lg input[type="search"] {
	padding: 0.95rem 1.1rem 0.95rem 2.9rem;
	font-size: 1rem;
}
.aa-searchform--lg {
	position: relative;
	border-radius: 0.875rem;
}
.aa-searchform--lg .aa-search-icon {
	position: absolute;
	left: 1rem;
	top: 50%;
	height: 1.25rem;
	width: 1.25rem;
	transform: translateY(-50%);
	color: #94a3b8;
	pointer-events: none;
}
.aa-searchform--lg button {
	margin: 0.35rem;
	border-radius: 0.625rem;
	background: #367fee;
	padding: 0 1.5rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: #fff;
}
.aa-searchform--lg button:hover {
	background: #2860bd;
}

/* ---- Category chips (blog/archive listing header) ---- */
.aa-cat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	list-style: none;
	margin: 0;
	padding: 0;
}
.aa-cat-chips a {
	display: block;
	border-radius: 0.625rem;
	background: #eef5fe;
	padding: 0.6rem 1.1rem;
	font-size: 0.875rem;
	color: #2860bd;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.aa-cat-chips a:hover {
	background: #d8e8fc;
}
.aa-cat-chips .is-current a {
	background: #367fee;
	color: #fff;
}

/* ---- FAQ accordion (front-page.php) ---- */
.aa-faq-item {
	border-radius: 0.875rem;
	background: #eef5fe;
	transition: background-color 0.15s ease;
}
.aa-faq-item + .aa-faq-item {
	margin-top: 0.75rem;
}
.aa-faq-item > summary {
	display: flex;
	cursor: pointer;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	list-style: none;
	padding: 1.1rem 1.25rem;
	font-weight: 600;
	color: #2f72db;
}
.aa-faq-item > summary::-webkit-details-marker {
	display: none;
}
.aa-faq-item > summary svg {
	height: 1.25rem;
	width: 1.25rem;
	flex: none;
	color: #5b9bf2;
	transition: transform 0.2s ease;
}
.aa-faq-item[open] > summary svg {
	transform: rotate(180deg);
}
.aa-faq-answer {
	padding: 0 1.25rem 1.25rem;
	line-height: 1.7;
	color: #334155;
}
.aa-faq-answer p + p {
	margin-top: 0.85rem;
}

/* ---- Post hero (featured image at the top of a post) ---- */
.aa-post-hero {
	margin: 1.75rem 0 0;
}
.aa-post-hero img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 1rem;
}
.aa-post-hero figcaption {
	margin-top: 0.6rem;
	text-align: center;
	font-size: 0.8rem;
	color: #64748b;
}
