/* ============================================================
   TRÚC XINH – Global Styles & Resets
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap&subset=vietnamese');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

main,
.page-wrapper,
.footer {
  position: relative;
  z-index: 1;
}

.site-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.decor {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.decor-bamboo-frame {
  top: var(--nav-height);
  left: 0;
  width: 100vw;
  opacity: 0.08;
}

.decor-bamboo-left {
  left: -7rem;
  top: 28vh;
  height: 64vh;
  opacity: 0.18;
}

.decor-bamboo-right {
  right: -7rem;
  top: 18vh;
  height: 58vh;
  transform: scaleX(-1);
  opacity: 0.16;
}

.decor-bamboo-soft {
  right: 5vw;
  top: 54vh;
  height: 46vh;
  transform: rotate(-7deg);
  opacity: 0.10;
}

.decor-wave-center {
  left: 50%;
  bottom: -4.5rem;
  width: min(48rem, 62vw);
  transform: translateX(-50%);
  opacity: 0.16;
}

.decor-wave-wide {
  left: 0;
  bottom: -2.8rem;
  width: 100vw;
  opacity: 0.12;
}

.decor-wave-small {
  right: 18vw;
  bottom: -1.5rem;
  width: 23rem;
  opacity: 0.12;
}

.decor-lotus-left {
  left: -1rem;
  bottom: 12vh;
  width: 19rem;
  opacity: 0.18;
}

.decor-lotus-mid {
  left: 7vw;
  bottom: 1vh;
  width: 17rem;
  opacity: 0.12;
}

.decor-lotus-right {
  right: -2rem;
  bottom: 19vh;
  width: 18rem;
  transform: scaleX(-1);
  opacity: 0.15;
}

.decor-leaf-left {
  left: 4vw;
  bottom: 0;
  width: 20rem;
  opacity: 0.16;
}

.decor-leaf-right {
  right: 5vw;
  bottom: 2vh;
  width: 18rem;
  transform: scaleX(-1);
  opacity: 0.14;
}

.decor-dragon-boat {
  right: 6vw;
  bottom: 6vh;
  width: min(30rem, 30vw);
  opacity: 0.13;
}

.decor-stone-left {
  left: -13rem;
  bottom: -10rem;
  width: 35rem;
  opacity: 0.10;
}

.decor-stone-right {
  right: -11rem;
  bottom: -8rem;
  width: 34rem;
  opacity: 0.10;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
ul, ol { list-style: none; }
input, textarea, select { font-family: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-secondary); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-accent); }

/* ── Focus Visible ── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Selection ── */
::selection {
  background: var(--color-highlight);
  color: var(--color-text);
}

/* ── Container ── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 768px) {
  .container { padding: 0 var(--space-4); }
  .decor-bamboo-frame,
  .decor-bamboo-left,
  .decor-bamboo-right,
  .decor-bamboo-soft,
  .decor-dragon-boat,
  .decor-stone-left,
  .decor-stone-right {
    display: none;
  }
  .decor-wave-wide {
    width: 180vw;
    left: -40vw;
  }
  .decor-lotus-left,
  .decor-lotus-right,
  .decor-leaf-left,
  .decor-leaf-right {
    width: 11rem;
    opacity: 0.12;
  }
}

/* ── Section Spacing ── */
.section { padding: var(--section-py) 0; }
.section-sm { padding: var(--space-12) 0; }
.section-lg { padding: var(--space-32) 0; }

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-10);
}

.section-title {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-secondary);
  letter-spacing: 0.02em;
}

.section-title span {
  color: var(--color-accent);
}

.section-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: gap var(--transition-base), color var(--transition-base);
}

.section-link:hover {
  color: var(--color-accent);
  gap: var(--space-3);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: 1.2;
  color: var(--color-secondary);
}

h1 { font-size: clamp(2rem, 5vw, var(--text-5xl)); }
h2 { font-size: clamp(1.5rem, 3vw, var(--text-3xl)); }
h3 { font-size: clamp(1.25rem, 2vw, var(--text-2xl)); }

p { color: var(--color-text-muted); line-height: 1.8; }

/* ── Tag/Badge ── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag-accent {
  background: rgba(200,55,74,0.12);
  color: var(--color-accent);
  border: 1px solid rgba(200,55,74,0.2);
}

.tag-highlight {
  background: rgba(255,213,116,0.25);
  color: var(--color-secondary);
  border: 1px solid rgba(255,213,116,0.4);
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-border), transparent);
  margin: var(--space-8) 0;
}

/* ── Page Layout ── */
.page-wrapper {
  padding-top: var(--nav-height);
  min-height: 100vh;
}

/* ── Utility ── */
.text-center { text-align: center; }
.text-accent { color: var(--color-accent); }
.text-secondary { color: var(--color-secondary); }
.text-muted { color: var(--color-text-muted); }
.font-serif { font-family: var(--font-serif); }
.font-display { font-family: var(--font-display); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200,55,74,0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(200,55,74,0); }
}
@keyframes underlineGrow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes bamboo-sway {
  0%, 100% { transform: rotate(-2deg); }
  50%       { transform: rotate(2deg); }
}

.animate-fade-up  { animation: fadeInUp 0.6s ease both; }
.animate-fade-in  { animation: fadeIn 0.5s ease both; }
.animate-scale-in { animation: scaleIn 0.4s ease both; }

/* ── Loading ── */
.page-loader {
  position: fixed; inset: 0;
  background: var(--color-bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.page-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-ring {
  width: 48px; height: 48px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Toast Notification ── */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--color-secondary);
  color: var(--color-white);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  min-width: 260px;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--color-accent);
}
.toast.success { border-left-color: #4caf50; }
.toast.error   { border-left-color: var(--color-accent); }
