/*
Theme Name: Code2Smile 2026
Theme URI: https://code2smile.com
Author: Luan Vo
Author URI: https://code2smile.com
Description: Landing page cho các app của HaDoSolution và dịch vụ làm web, app, server; blog nằm ở /blog/. Thiết kế "C · Bento" (xem .tm/project/architecture.md, mục "Thiết kế mới").
Version: 0.1.0
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: code2smile-2026
*/

/* Token của thiết kế C. Đổi màu hay font thì sửa ở đây và ở bảng trong
   architecture.md, để hai nơi không lệch nhau. */
:root {
	--c-ground: #F1F2EE;
	--c-surface: #FFFFFF;
	--c-ink: #161616;
	--c-ink-soft: #4D4D4D;
	--c-line: #D4D5CE;
	--c-hover: #E6E8E0;
	/* Màu nhấn dùng chung màu xanh của hero (chủ project chọn ngày
	   2026-10-24, thay cho cam). Chữ trên nền nhấn phải là trắng: chữ đen trên
	   xanh này chỉ đạt khoảng 2.9:1, chữ trắng đạt khoảng 6:1. */
	--c-accent: var(--c-brand);
	--c-brand: #3B5BDB;
	--c-brand-soft: #EEF2FF;
	--c-sun: #FFD84D;
	--c-teal: #0E7C66;
	--c-lilac: #D9CCFF;
	/* Cam cũ của màu nhấn, giờ chỉ còn là màu của ô dịch vụ Web. */
	--c-coral: #FF8A65;

	--font-display: 'Bricolage Grotesque', 'Be Vietnam Pro', system-ui, sans-serif;
	--font-body: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

	--radius-lg: 32px;
	--radius-md: 28px;
	--radius-sm: 20px;
	--container: 1240px;
	--gutter: 24px;
	/* site.js ghi chiều cao thật của header vào đây; giá trị này chỉ dùng tới
	   khi script chạy xong. */
	--header-height: 72px;

	--ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* Nền tảng */

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

html {
	/* Anchor (#san-pham…) dừng sát đáy header dính thay vì bị nó che. Không
	   chừa thêm khoảng nào: section của landing đã có padding trên riêng, chừa
	   thêm thì một dải hero lộ ra dưới header trông như lỗi. Heading trong bài
	   viết cần khoảng thở thì tự thêm bằng scroll-margin-top (blog.css). */
	scroll-padding-top: var(--header-height);
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
}

/* iOS/iPadOS (mọi trình duyệt trên đó đều là WebKit) cho trang nảy khi kéo
   quá cuối, lộ ra một khoảng nền trống dưới footer. Chỉ tắt ở đó: trên
   Android, tắt overscroll ở gốc trang là mất luôn kéo-để-tải-lại.
   -webkit-touch-callout chỉ WebKit trên iOS mới hiểu. */
@supports (-webkit-touch-callout: none) {
	html {
		overscroll-behavior-y: none;
	}
}

body {
	margin: 0;
	background: var(--c-ground);
	color: var(--c-ink);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.6;
}

img,
svg,
canvas {
	display: block;
	max-width: 100%;
}

a {
	color: inherit;
	text-decoration: none;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

h1,
h2,
h3 {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 1.05;
	/* Tên hàm dài như getChildFragmentManager không có chỗ ngắt; không cho
	   ngắt giữa từ thì nó đẩy cả trang tràn ngang trên điện thoại. */
	overflow-wrap: anywhere;
}

p {
	margin: 0;
}

:focus-visible {
	outline: 3px solid var(--c-brand);
	outline-offset: 3px;
}

.container {
	width: 100%;
	max-width: var(--container);
	margin: 0 auto;
	padding-inline: var(--gutter);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	z-index: 100;
	left: 16px;
	top: -100px;
	padding: 12px 18px;
	border-radius: 999px;
	background: var(--c-ink);
	color: #FFFFFF;
	font-weight: 700;
}

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

/* Header dính */

.site-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: rgba(241, 242, 238, 0.88);
	-webkit-backdrop-filter: saturate(160%) blur(12px);
	backdrop-filter: saturate(160%) blur(12px);
	border-bottom: 1px solid rgba(22, 22, 22, 0.06);
}

.admin-bar .site-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

/* Từ 600px trở xuống core đổi admin bar sang position: absolute, nó cuộn đi
   theo trang. Giữ phần bù ở trên thì header dừng cách mép 46px, lộ một dải
   nội dung phía trên nó. Breakpoint phải khớp admin-bar.css của core. */
@media screen and (max-width: 600px) {
	.admin-bar .site-header {
		top: 0;
	}
}

/* Thứ tự hiển thị: desktop là logo | menu | VI/EN; điện thoại là logo và VI/EN
   trên một hàng, menu chiếm trọn hàng dưới (xem media query ở dưới). */
.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	padding-block: 14px;
}

.brand {
	margin-right: auto;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 20px;
	font-weight: 800;
}

.brand__mark {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: var(--c-accent);
	color: #FFFFFF;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
}

.site-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding: 6px;
	border-radius: 999px;
	background: var(--c-surface);
	font-size: 15px;
	font-weight: 600;
}

.site-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 8px 16px;
	border-radius: 999px;
	transition: background-color .25s ease, color .25s ease, transform .15s ease;
}

.site-nav__link svg {
	transition: transform .35s var(--ease-spring);
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
	background: var(--c-hover);
}

.site-nav__link:hover svg,
.site-nav__link:focus-visible svg {
	transform: translateY(-2px) scale(1.15) rotate(-6deg);
}

.site-nav__link:active {
	transform: scale(.96);
}

.site-nav__link--cta {
	padding-inline: 18px;
	background: var(--c-accent);
	color: #FFFFFF;
}

.site-nav__link--cta:hover,
.site-nav__link--cta:focus-visible {
	background: var(--c-ink);
	color: #FFFFFF;
}

.site-nav {
	order: 2;
}

.lang-switch {
	order: 3;
	display: flex;
	gap: 2px;
	padding: 6px;
	border-radius: 999px;
	background: var(--c-surface);
	font-size: 14px;
}

.lang-switch__link {
	min-width: 44px;
	min-height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	color: var(--c-ink-soft);
	font-weight: 600;
	transition: background-color .2s ease, color .2s ease, transform .15s ease;
}

.lang-switch__link:hover,
.lang-switch__link:focus-visible {
	background: var(--c-hover);
	color: var(--c-ink);
}

.lang-switch__link:active {
	transform: scale(.92);
}

.lang-switch__link[aria-current="true"] {
	background: var(--c-accent);
	color: #FFFFFF;
	font-weight: 800;
}

/* Điện thoại: menu chiếm trọn một hàng dưới logo, các mục chia đều nhau thay
   vì dồn sang phải rồi tràn; nút VI/EN lên cùng hàng với logo. */
@media (max-width: 640px) {
	.lang-switch {
		order: 1;
	}

	/* Chữ 14px, padding 10px và gap 4px để ba mục tiếng Việt vừa một hàng ở
	   390px: với 15px/12px/6px chúng cần khoảng 338px trong 330px, và "Liên
	   hệ" bị đẩy xuống hàng (đo trên prod 2026-10-24). */
	.site-nav {
		width: 100%;
		gap: 4px;
		justify-content: space-between;
		font-size: 14px;
	}

	.site-nav__link {
		flex: 1 1 auto;
		justify-content: center;
		padding-inline: 10px;
	}
}

/* Điện thoại hẹp (375px như iPhone SE/mini, 360–384px như phần lớn máy
   Android): bản 14px chỉ vừa từ khoảng 382px và vẫn xuống hàng trên Samsung
   A56 (381px), nơi chữ thường được vẽ to hơn. 13px, padding 8px và icon cách
   chữ 6px để còn dư chỗ ngay cả ở 360px. */
@media (max-width: 420px) {
	.site-nav {
		font-size: 13px;
	}

	.site-nav__link {
		gap: 6px;
		padding-inline: 8px;
	}
}

/* "page": đang ở trang blog. "true": section đang xem trên landing (site.js). */
.site-nav__link[aria-current="page"],
.site-nav__link[aria-current="true"] {
	background: var(--c-ink);
	color: #FFFFFF;
}

/* Nút */

.button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding: 14px 26px;
	border: 1px solid transparent;
	border-radius: 999px;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: transform .25s var(--ease-spring), box-shadow .25s ease, background-color .2s ease, color .2s ease;
}

.button:hover,
.button:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 12px 28px rgba(22, 22, 22, .22);
}

.button:active {
	transform: scale(.97);
	box-shadow: none;
}

.button--light {
	background: #FFFFFF;
	color: var(--c-ink);
}

.button--outline-light {
	border-color: rgba(255, 255, 255, .7);
	color: #FFFFFF;
	font-weight: 600;
}

.button--dark {
	background: var(--c-ink);
	color: #FFFFFF;
}

.button--dark:hover,
.button--dark:focus-visible {
	background: var(--c-brand);
}

.button--accent {
	background: var(--c-accent);
	color: #FFFFFF;
}

.button--accent:hover,
.button--accent:focus-visible {
	background: var(--c-ink);
	color: #FFFFFF;
}

.chip {
	align-self: flex-start;
	display: inline-block;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--c-ground);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}

.chip--dark {
	background: var(--c-ink);
	color: #FFFFFF;
}

.text-link {
	font-weight: 600;
	transition: color .2s ease;
}

.text-link:hover,
.text-link:focus-visible {
	color: var(--c-brand);
}

/* Dải màu xanh có particles: hero của landing và banner của blog. */

.band {
	position: relative;
	overflow: hidden;
	background: var(--c-brand);
	color: #FFFFFF;
}

.band__particles {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.band__inner {
	position: relative;
	padding-block: 72px 64px;
}

/* Điện thoại: khoảng trên mọi section là 56px, như hero (landing.css). */
@media (max-width: 480px) {
	.band__inner {
		padding-top: 56px;
	}
}

.band__eyebrow {
	font-size: 14px;
	color: var(--c-brand-soft);
}

.band__eyebrow a:hover {
	text-decoration: underline;
}

.band__title {
	margin-top: 18px;
	font-size: clamp(44px, 6vw, 80px);
	line-height: .98;
	letter-spacing: -0.035em;
}

.band__title em {
	font-style: normal;
	color: var(--c-sun);
}

.band__lead {
	margin-top: 18px;
	max-width: 560px;
	font-size: 18px;
	line-height: 1.65;
	color: var(--c-brand-soft);
}

/* Thẻ bài: dùng chung cho phần "Từ blog" của landing và trang blog (blog.css). */

.post-card {
	position: relative;
	flex: 1 1 320px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 28px;
	border-radius: var(--radius-md);
	background: var(--c-surface);
	transition: transform .4s var(--ease-spring), box-shadow .4s ease;
}

.post-card:hover,
.post-card:focus-within {
	transform: translateY(-6px);
	box-shadow: 0 18px 40px rgba(22, 22, 22, .14);
}

.post-card__meta {
	font-size: 14px;
	color: var(--c-ink-soft);
}

.post-card__title {
	font-family: var(--font-body);
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.35;
}

.post-card__title a {
	transition: color .25s ease;
}

.post-card:hover .post-card__title a,
.post-card__title a:focus-visible {
	color: var(--c-brand);
}

/* Mở rộng vùng bấm ra cả thẻ mà vẫn chỉ có một link cho trình đọc màn hình. */
.post-card__title a::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.post-card__excerpt {
	font-size: 15px;
	color: var(--c-ink-soft);
}

/* Footer */

.site-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 16px;
	padding-block: 24px 40px;
	font-size: 14px;
	color: var(--c-ink-soft);
}

.site-footer__links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 20px;
}

.site-footer__links a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.site-footer .c2s-consent-open {
	text-decoration: none;
}

.site-footer .c2s-consent-open:hover,
.site-footer .c2s-consent-open:focus-visible {
	color: var(--c-brand);
}

/* Nút lên đầu trang (template-parts/scroll-top.php, site.js). */

.scroll-top {
	position: fixed;
	right: 20px;
	/* site.js nâng nút lên bằng --scroll-top-lift khi footer lọt vào màn hình,
	   để nút đứng trên footer chứ không đè lên link của nó. */
	bottom: calc(20px + var(--scroll-top-lift, 0px));
	/* Dưới header dính (20) và banner cookie (1000). */
	z-index: 15;
	width: 84px;
	height: 84px;
	padding: 0;
	display: grid;
	place-items: center;
	border: 1px solid rgba(22, 22, 22, 0.08);
	border-radius: 50%;
	/* Nền kính mờ như header, để vòng chữ đọc được trên mọi nội dung bên dưới. */
	background: rgba(241, 242, 238, 0.72);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--c-ink-soft);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity .3s ease, visibility .3s ease, transform .3s ease, color .3s ease, background-color .3s ease, border-color .3s ease;
}

.scroll-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.scroll-top:focus-visible {
	outline: 3px solid var(--c-brand);
	outline-offset: 3px;
}

.scroll-top__ring {
	position: absolute;
	inset: 4px;
	width: calc(100% - 8px);
	height: calc(100% - 8px);
	fill: currentColor;
	font: 700 9.5px var(--font-body);
	animation: c2s-ring-spin 12s linear infinite;
}

@keyframes c2s-ring-spin {
	to {
		transform: rotate(360deg);
	}
}

.scroll-top__core {
	position: relative;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	overflow: hidden;
	border-radius: 50%;
	background: var(--c-accent);
	color: #FFFFFF;
	transition: background-color .3s ease, color .3s ease;
}

/* Lớp màu lan từ tâm ra khi hover. */
.scroll-top__core::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--c-ink);
	transform: scale(0);
	transition: transform .3s ease;
}

.scroll-top:hover .scroll-top__core::before,
.scroll-top:focus-visible .scroll-top__core::before {
	transform: scale(1);
}

.scroll-top__rocket {
	position: relative;
	transition: transform .3s var(--ease-spring);
}

.scroll-top:hover .scroll-top__rocket,
.scroll-top:focus-visible .scroll-top__rocket {
	transform: translateY(-3px);
}

/* Lửa chỉ phụt ra khi hover hay khi cất cánh, co giãn từ miệng động cơ. */
.scroll-top__flame {
	fill: var(--c-sun);
	transform-box: fill-box;
	transform-origin: 50% 0;
	transform: scaleY(0);
	transition: transform .2s ease;
}

.scroll-top:hover .scroll-top__flame,
.scroll-top:focus-visible .scroll-top__flame {
	transform: scaleY(1);
	animation: c2s-flame-flicker .12s ease-in-out infinite alternate;
}

@keyframes c2s-flame-flicker {
	from {
		transform: scaleY(.75);
	}

	to {
		transform: scaleY(1.1);
	}
}

/* Bấm nút: tàu nhún xuống lấy đà rồi bay vọt ra khỏi vòng tròn; site.js chờ
   đúng thời lượng này rồi mới cuộn trang. */
.scroll-top.is-launching .scroll-top__rocket {
	animation: c2s-rocket-launch .45s cubic-bezier(.55, 0, .75, .2) forwards;
}

.scroll-top.is-launching .scroll-top__flame {
	transform: scaleY(1.4);
	animation: none;
}

@keyframes c2s-rocket-launch {
	20% {
		transform: translateY(2px);
	}

	to {
		transform: translateY(-64px);
	}
}

/* Trên khối nền xanh (hero, khối liên hệ) thì đảo tông cho nổi lên. Nền
   xanh khá đặc: nút hay nằm ở mép khối, nửa vòng đè lên thẻ form màu sáng,
   và chữ trắng trên nền trong suốt thì không đọc được ở nửa đó. */
.scroll-top.is-on-dark {
	border-color: rgba(255, 255, 255, 0.35);
	background: rgba(59, 91, 219, 0.82);
	color: #FFFFFF;
}

.scroll-top.is-on-dark:focus-visible {
	outline-color: #FFFFFF;
}

.scroll-top.is-on-dark .scroll-top__core {
	background: #FFFFFF;
	color: var(--c-brand);
}

.scroll-top.is-on-dark:hover .scroll-top__core,
.scroll-top.is-on-dark:focus-visible .scroll-top__core {
	color: #FFFFFF;
}

@media (max-width: 640px) {
	.scroll-top {
		right: 12px;
		bottom: calc(12px + var(--scroll-top-lift, 0px));
		width: 68px;
		height: 68px;
	}

	.scroll-top__core {
		width: 36px;
		height: 36px;
	}

	.scroll-top__rocket {
		width: 18px;
		height: 24px;
	}

	/* Trên điện thoại banner cookie chiếm cả bề ngang đáy màn hình, đúng chỗ
	   của nút; nút chờ người xem chọn xong. */
	body:has(.c2s-consent:not([hidden])) .scroll-top.is-visible {
		opacity: 0;
		visibility: hidden;
	}
}

/* Người xem đã tắt chuyển động trong hệ điều hành: bỏ mọi hiệu ứng di chuyển. */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
	}

	.site-nav__link:hover svg,
	.site-nav__link:active,
	.button:hover,
	.button:active,
	.post-card:hover,
	.post-card:focus-within,
	.scroll-top:hover .scroll-top__rocket,
	.scroll-top:focus-visible .scroll-top__rocket {
		transform: none;
	}
}
