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

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

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* The dusk: a navy-to-periwinkle sky with a pale bloom low right, then a fine vertical-streak curtain over it. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background:
    radial-gradient(70% 55% at 90% 104%, rgb(214 226 255 / 0.36), transparent 70%),
    radial-gradient(55% 40% at 42% 66%, rgb(125 143 203 / 0.5), transparent 75%),
    radial-gradient(60% 45% at 0% 0%, rgb(8 12 40 / 0.85), transparent 70%),
    linear-gradient(180deg, var(--sky-0) 0%, var(--sky-1) 12%, var(--sky-3) 32%, var(--sky-4) 100%);
}
body::after {
  background:
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.035) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.035) 0 4px, transparent 4px 47px),
    repeating-linear-gradient(90deg, rgb(8 12 44 / 0.09) 0 6px, transparent 6px 31px);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 100%);
}

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: inherit; }

/* browser surfaces carry the palette too */
::selection { background: rgb(153 180 254 / 0.45); color: #fff; }
input { caret-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: #a4bdfd rgb(255 255 255 / 0.1); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #a4bdfd; border-radius: 8px; }
::-webkit-scrollbar-track { background: rgb(255 255 255 / 0.1); border-radius: 8px; }

:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--sky-0);
  border-radius: var(--r-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 8px; }

.vh {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon, .tab-icon {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---- top bar, shared by every page ---- */
.topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 32px;
  height: var(--header-h);
  padding-inline: var(--pad);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: none;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--brand-crimson);
  box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.55), 0 6px 16px rgb(0 0 0 / 0.45);
  object-fit: cover;
}
.brand-name { display: grid; gap: 1px; line-height: 1; white-space: nowrap; }
.brand-name .b1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.25;
  text-shadow: 0 2px 12px rgb(0 0 0 / 0.5);
}
.brand-name .b2 {
  font-family: var(--font-script);
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--brand-cream);
  text-shadow: 0 2px 0 rgb(139 18 41 / 0.7), 0 4px 10px rgb(0 0 0 / 0.35);
}

.mainnav { display: flex; gap: 4px; margin-left: auto; }
.mainnav a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 20px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-text { display: grid; gap: 3px; }
.mainnav .cap {
  font-family: var(--font-tech);
  font-size: var(--fs-cap);
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.7);
  transition: color var(--t-fast);
}
.mainnav .lab { font-size: 0.875rem; font-weight: 600; line-height: 1.2; }
.mainnav a:hover { color: #fff; background: var(--glass-soft); }
.mainnav a[aria-current="page"] { color: #fff; }
.mainnav a[aria-current="page"] .cap { color: var(--accent); }
/* the current page gets a light bar at its left edge, as on the official site */
.mainnav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  translate: 0 -50%;
  width: 3px;
  height: 30px;
  border-radius: 3px;
  background: linear-gradient(180deg, #fff, var(--accent-lo));
}
.mainnav .icon { display: none; }

/* phones: the nav moves to the thumb zone as a bottom bar */
@media (max-width: 819px) {
  :root { --pad: 14px; --header-h: 58px; --nav-h: 60px; }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
  .topbar { gap: 12px; }
  .brand { gap: 10px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .brand-name .b1 { font-size: 1rem; }
  .brand-name .b2 { font-size: 0.95rem; }
  .mainnav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--glass-strong);
    border-top: 1px solid var(--glass-line);
  }
  /* "Về chúng tôi" isn't a page people jump to often; drop it from the thumb-zone bar and
     leave it reachable from the site footer instead, so the 5 main pages keep their room. */
  .mainnav a:last-child { display: none; }
  .mainnav a {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: var(--nav-h);
    padding: 6px 2px;
    border-radius: 0;
    font-size: var(--fs-xs);
    background: none;
  }
  .mainnav .icon { display: block; width: 22px; height: 22px; }
  .mainnav .cap { display: none; }
  .nav-text { width: 100%; overflow: hidden; text-align: center; }
  .mainnav .lab { display: block; overflow: hidden; font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }
  .mainnav a[aria-current="page"] { color: var(--accent); }
  .mainnav a[aria-current="page"]::before {
    left: 50%;
    top: 0;
    translate: -50% 0;
    width: 28px;
    height: 3px;
    background: var(--accent-grad);
    border-radius: 0 0 3px 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .swing { animation: none !important; }
}

/* ---- Facebook link (topbar icon) and the site footer, shared by every page ---- */
.fb-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: 4px;
  background: var(--accent-grad);
  border-radius: 12px;
  color: var(--accent-deep);
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.3);
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-fast);
}
.fb-icon .icon { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.fb-icon:hover { transform: translateY(-2px); box-shadow: 0 8px 14px rgb(0 0 0 / 0.35); }

.sitefoot {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin: 0 var(--pad) 14px;
  padding: 10px 14px 10px 12px;
  background: var(--glass-list);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
}
.fb-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 10px;
  background: var(--accent-grad);
  border-radius: var(--r-md);
  color: var(--accent-deep);
  text-decoration: none;
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.3);
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-fast);
}
.fb-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 14px rgb(0 0 0 / 0.35); }
.fb-btn .icon { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.fb-text { display: grid; gap: 1px; line-height: 1.1; }
.fb-cap { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: 0.06em; text-transform: uppercase; }
.fb-lab { font-size: var(--fs-xs); font-weight: 600; }
.sitefoot-right { display: flex; align-items: center; gap: 10px; }
.sitefoot-text { margin: 0; max-width: 62ch; text-align: right; font-size: var(--fs-xs); line-height: 1.6; color: var(--text-2); }
.sitefoot-text strong { color: #fff; font-weight: 700; }
.sitefoot-text a { color: var(--accent); text-underline-offset: 2px; }
.sitefoot-text a:hover { color: var(--accent-hi); }

/* a small donate nudge beside the footer credit, open with a click, no script needed;
   sized as the system's icon-button (40px, 44px on phones), same recipe as .icon-btn and .fb-icon */
.donate { position: relative; flex: none; }
.donate summary {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--accent-grad);
  border-radius: 999px;
  color: var(--accent-deep);
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.3);
  cursor: pointer;
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-fast);
}
.donate summary::-webkit-details-marker { display: none; }
.donate summary::marker { content: ""; }
.donate summary .icon { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.donate summary:hover { transform: translateY(-2px); box-shadow: 0 8px 14px rgb(0 0 0 / 0.35); }
.donate[open] summary { box-shadow: 0 0 0 2px var(--accent-hi); }
.donate-pop {
  position: absolute;
  bottom: 48px;
  left: 50%;
  translate: -50% 0;
  z-index: 10;
  width: 200px;
  padding: 14px;
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 32px rgb(0 0 0 / 0.45);
}
.donate-pop img { width: 100%; height: auto; border-radius: var(--r-md); }
.donate-pop p { margin: 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--text-2); }

@media (max-width: 819px) {
  .donate summary { width: 44px; height: 44px; }
  .donate summary .icon { width: 20px; height: 20px; }
  .donate-pop { bottom: 52px; width: 168px; }
}

@media (max-width: 819px) {
  .fb-icon { margin-left: auto; width: 38px; height: 38px; }
  .sitefoot { margin-inline: 10px; margin-bottom: 8px; padding: 8px 10px; gap: 8px 12px; }
  .fb-btn { padding: 4px 12px 4px 8px; }
  .fb-lab { display: none; }
  .sitefoot-text { text-align: left; font-size: 0.6875rem; line-height: 1.45; }
}

/* short pages: the footer rests at the bottom of the window instead of floating under the content */
body:not(.app-shell) { display: flex; flex-direction: column; min-height: 100dvh; }
body:not(.app-shell) > main { width: 100%; }
body:not(.app-shell) .sitefoot { margin-top: auto; }
