/* =====================================================================
   style.css - Landing 20nam.safi.edu.vn (DEMO, bản nền tĩnh, ưu tiên điện thoại)
   Mobile-first (chuẩn 390x844). Dùng biến từ tokens.css. Không framework.
   Nguyên tắc: một nhịp khoảng cách (8/12/16/24/40), một màu nhấn (vàng),
   ít khung lồng nhau, mục tiêu chạm >= 44px, chữ thân bài >= 16px.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; scroll-padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px); }
:root { --hdr: 0px; --gutter: 16px; --section-y: 48px; --safe-b: env(safe-area-inset-bottom, 0px); --tab-h: 64px; }
body { margin: 0; background: var(--bg-page); color: var(--text-on-dark); font-family: var(--font-body); font-size: 1rem; line-height: 1.55; overflow-x: hidden; }
img, canvas, svg { max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; box-shadow: 0 0 0 6px var(--navy-900); border-radius: 6px; }
.section-cream :focus-visible { outline-color: var(--navy-ink); box-shadow: 0 0 0 6px var(--gold-300); }

.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 8px; top: -400px; z-index: 100; background: var(--gold-300); color: var(--navy-900); padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 8px; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.lead { font-size: 1rem; line-height: 1.6; color: var(--text-on-dark-muted); }
@media (min-width: 360px) { :root { --gutter: 20px; } }

/* ---------- Cụm logo (header + footer): logo trường | vạch | huy hiệu 20 năm ---------- */
.brand-logos { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.logo-safi { display: block; width: 48px; height: 48px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(255,214,120,.85), 0 4px 14px rgba(0,10,60,.45); }
.logo-20 { display: block; width: 52px; height: auto; aspect-ratio: 320 / 322; filter: drop-shadow(0 2px 6px rgba(0,10,60,.45)); }
.brand-vline { width: 1.5px; height: 40px; background: linear-gradient(transparent, #ffd978 25%, #ffd978 75%, transparent); }

/* ---------- Header: mobile = nổi trên hero (không cố định), điều hướng nằm ở thanh dưới ---------- */
.site-header { position: absolute; z-index: var(--z-header); top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; color: #fff; border-radius: 8px; }
.brand-name { display: flex; flex-direction: column; min-width: 0; font-family: var(--font-display); font-weight: 800; font-size: .75rem; line-height: 1.25; letter-spacing: .05em; text-transform: uppercase; text-shadow: 0 1px 8px rgba(2,12,70,.8); }
.bn-vi { max-width: 17ch; }
.bn-en { display: none; font-family: var(--font-body); font-weight: 500; font-size: .75rem; letter-spacing: .04em; }
.nav { display: none; }
@media (max-width: 349px) { .brand-name { font-size: .6875rem; } .logo-safi { width: 44px; height: 44px; } .logo-20 { width: 48px; } }

/* ---------- Thanh điều hướng dưới (chỉ điện thoại; hiện sau khi cuộn khỏi hero) ---------- */
.tabbar { position: fixed; z-index: var(--z-header); left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 6px; padding: 6px 10px calc(6px + var(--safe-b)); background: rgba(3,20,72,.96); border-top: 1px solid rgba(255,224,138,.3); transform: translateY(110%); visibility: hidden; transition: transform var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base); }
.tabbar.is-on { transform: none; visibility: visible; transition-delay: 0s; }
html.no-js .tabbar { transform: none; visibility: visible; }
.tabbar a { min-width: 0; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: 12px; text-decoration: none; color: #fff; font-size: .8125rem; font-weight: 700; line-height: 1.2; }
.tabbar a[aria-current="true"] { background: rgba(255,255,255,.12); }
.tabbar .tab-cta { background: var(--grad-gold); color: var(--navy-900); }
.tabbar .tab-cta, .tabbar .tab-cta[aria-current="true"] { background: var(--grad-gold); }
.tabbar .tab-cta[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--navy-900); }

/* ---------- Hero (mobile): nền tĩnh, chữ HTML thật ---------- */
.hero { position: relative; isolation: isolate; display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; background: #051e69; overflow: hidden; }
.hero-media { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 0; }
.hero-img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; object-position: 100% 30%; }
.hero-scrim { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(180deg, rgba(3,20,72,.55) 0%, rgba(3,20,72,.18) 20%, rgba(3,20,72,0) 50%, rgba(3,20,72,.5) 58%, rgba(3,20,72,.88) 68%, rgba(3,20,72,.94) 100%); }
.hero-copy, .hero-dock { position: relative; z-index: 2; }
.hero-copy { padding: 84px var(--gutter) 28px; text-align: center; background: linear-gradient(180deg, rgba(3,20,72,.5) 0, rgba(3,20,72,.5) calc(100% - 32px), rgba(3,20,72,0) 100%); }
.hero-copy h1 { line-height: 1; }
.hero-copy .t-script { display: block; font-size: 2.25rem; line-height: 1.2; }
.hero-copy .t-display { display: block; font-size: 1.625rem; line-height: 1.15; margin-top: -2px; letter-spacing: .03em; }
.hero-moc { display: none; margin-top: 6px; font-weight: 600; letter-spacing: .2em; color: var(--gold-100); font-size: .875rem; text-shadow: var(--text-shadow-white); }
.hero-slogan { margin-top: 10px; }
.hero-slogan .t-slogan { display: block; font-size: 1.5rem; }
.hero-soar { display: none; font-family: var(--font-display); font-weight: 700; letter-spacing: .1em; text-shadow: var(--text-shadow-white); }

.hero-dock { display: grid; gap: 12px; margin-top: auto; padding: 28px var(--gutter) calc(20px + var(--safe-b)); background: linear-gradient(180deg, rgba(3,20,72,0) 0, rgba(3,20,72,.82) 28px); }
.tagline { text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1.35; color: var(--gold-100); max-width: 32ch; margin-inline: auto; text-wrap: balance; padding: 8px 14px; border-radius: 12px; background: rgba(3,20,72,.78); }
.hero-info { display: grid; gap: 8px; }
.hero-info-row { display: flex; gap: 10px; align-items: flex-start; line-height: 1.3; }
.hi-ico { flex: none; margin-top: 1px; color: var(--gold-200); }
.nw { white-space: nowrap; }
.hero-info-row strong { display: block; font-weight: 700; font-size: 1rem; }
.hero-info-row small { display: none; font-size: .875rem; color: var(--text-on-dark-muted); margin-top: 1px; }

.cta-row { display: grid; gap: 4px; }
.btn-lg { min-height: 56px; font-size: 1.0625rem; width: 100%; }
.btn-sec { display: none; min-height: 44px; background: transparent; border: 0; color: #fff; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(255,224,138,.7); font-size: 1rem; }
.btn-sec:hover { background: transparent; box-shadow: none; }

/* ---------- Đếm ngược ---------- */
.countdown { padding: 12px 12px 10px; text-align: center; width: 100%; }
.cd-eyebrow { display: none; margin: 0; }
.cd-head { font-family: var(--font-display); font-weight: 800; font-size: 1rem; line-height: 1.3; }
.cd-sub { margin-top: 4px; font-size: .875rem; color: var(--text-on-dark-muted); line-height: 1.4; }
.countdown[data-state="truoc_le"] .cd-sub { display: none; }
.cd-clock { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.cd-cell { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.cd-num { display: grid; place-items: center; width: 100%; min-height: 54px; padding: 4px 0; border-radius: 12px; font-size: 1.875rem; line-height: 1.1; background: linear-gradient(180deg, #0a2f8f 0%, #041a5c 100%); border: var(--border-gold-soft); font-family: var(--font-mono-num); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--gold-200); }
.cd-lab { margin-top: 4px; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-on-dark-muted); font-weight: 600; }
.cd-cell.tick .cd-num { animation: tick var(--dur-fast) var(--ease-out); }
.cd-cell.flip .cd-num { animation: flip-in var(--dur-base) var(--ease-out); }
.cd-clock.is-warn .cd-cell[data-u="phut"] .cd-num, .cd-clock.is-warn .cd-cell[data-u="giay"] .cd-num { color: var(--gold-100); border-color: var(--gold-300); }
.cd-tz { margin-top: 6px; font-size: .75rem; color: var(--text-on-dark-muted); letter-spacing: .04em; }
.cd-live { margin-top: 6px; }
.cd-live-now { font-size: 1rem; color: var(--gold-200); font-weight: 700; line-height: 1.35; text-wrap: balance; }
.cd-live-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(255,224,138,.7); }
.cd-noscript { margin-top: 10px; font-size: .875rem; }
.cd-noscript.dark { color: var(--navy-ink); }
.countdown[data-state="hom_nay"] .cd-clock { grid-template-columns: repeat(3, 1fr); }
.countdown[data-state="hom_nay"] [data-u="ngay"] { display: none; }
.countdown[data-state="dang_dien_ra"] .cd-clock, .countdown[data-state="sau_le"] .cd-clock { display: none; }
.countdown[data-state="dang_dien_ra"] .cd-tz, .countdown[data-state="sau_le"] .cd-tz { display: none; }
.countdown[data-state="dang_dien_ra"] .cd-sub { display: none; }
.countdown[data-state="dang_dien_ra"] .cd-head, .countdown[data-state="sau_le"] .cd-head { font-size: 1.0625rem; }
html.no-js .cd-clock { display: none; }

/* ---------- Nút ---------- */
.btn-navy { background: var(--navy-ink); color: #fff; border: 0; }
.btn-navy:hover { background: var(--navy-800); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--navy-ink); border: 2px solid var(--navy-ink); }
.btn-outline:hover { background: rgba(11,31,92,.08); }
.btn-gold-solid { background: var(--grad-gold); color: var(--navy-900); border: 1px solid var(--gold-500); box-shadow: 0 6px 16px rgba(201,150,43,.3); }
.btn-gold-solid:hover { transform: translateY(-2px); }
.btn-sm { min-height: 48px; padding: 0 14px; font-size: .9375rem; }
.btn svg { flex: none; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn { padding-inline: 20px; }

/* ---------- Khối chung ---------- */
.section { padding-block: var(--section-y); position: relative; }
.section-dark { background: var(--grad-navy); }
.section-cream { background: var(--grad-cream); color: var(--text-on-light); }
.t-eyebrow-light { color: var(--bronze-700); }
.section-cream .lead { color: var(--navy-ink); }
.section-cream .t-h2 { color: var(--navy-ink); }
.t-h2 { font-size: 1.625rem; }

/* ---------- Agenda: timeline dọc gọn ---------- */
.agenda-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.agenda-side .t-h2 { margin-top: 4px; }
.agenda-side .lead { margin-top: 6px; }
.ag-note { margin-top: 6px; font-size: 1rem; color: var(--gold-200); font-weight: 600; }
.ag-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.cal-wrap { position: relative; display: flex; }
.cal-wrap .btn, .ag-actions > .btn { flex: 1; padding-inline: 10px; }
.cal-menu { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; min-width: min(280px, calc(100vw - 2 * var(--gutter))); padding: 6px; display: grid; gap: 2px; background: #06236e; border: var(--border-gold-soft); border-radius: var(--radius-md); box-shadow: 0 16px 40px rgba(2,12,48,.6); }
.cal-menu a, .cal-menu button { display: flex; align-items: center; min-height: 52px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: #fff; font: 600 1rem var(--font-body); text-decoration: none; text-align: left; cursor: pointer; }
.cal-menu a:hover, .cal-menu button:hover { background: rgba(255,255,255,.12); }
.venue { display: flex; gap: 12px; align-items: flex-start; margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.14); scroll-margin-top: 16px; }
.ico-circle { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--grad-gold); color: var(--navy-900); display: inline-grid; place-items: center; }
.venue h3 { font-size: 1.0625rem; line-height: 1.3; }
.venue p { font-size: 1rem; color: var(--text-on-dark-muted); margin-top: 2px; line-height: 1.45; }
.venue-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold-200); font-weight: 700; }

.timeline { position: relative; display: grid; gap: 4px; }
.timeline::before { content: ""; position: absolute; left: 29px; top: 28px; bottom: 28px; width: 2px; background: rgba(255,224,138,.28); }
.ag-item { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); grid-template-areas: "ico head" "ico body"; column-gap: 12px; align-items: start; padding: 12px; border-radius: var(--radius-md); border: 1px solid transparent; }
.ag-ico { grid-area: ico; position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; background: #06236e; border: 1.5px solid rgba(255,224,138,.7); display: grid; place-items: center; color: var(--gold-200); }
.ag-ico svg { width: 20px; height: 20px; }
.ag-tick { display: none; position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; }
.ag-time { grid-area: head; justify-self: start; font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--gold-200); line-height: 1.3; padding-top: 6px; font-variant-numeric: tabular-nums; }
.ag-chip { grid-area: head; justify-self: end; align-self: start; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .03em; line-height: 1.6; }
.ag-body { grid-area: body; min-width: 0; margin-top: 2px; }
.ag-body h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem; line-height: 1.3; }
.ag-body p { margin-top: 4px; font-size: 1rem; color: var(--text-on-dark-muted); line-height: 1.5; }
.ag-item.is-current { background: var(--grad-panel); border-color: var(--gold-300); box-shadow: 0 8px 28px rgba(2,12,48,.45); }
.ag-item.is-current .ag-ico { background: var(--grad-gold); color: var(--navy-900); border-color: var(--gold-300); }
.ag-item.is-current .ag-chip { background: var(--gold-300); color: var(--navy-900); }
.ag-item.is-current .ag-chip::before { content: "● "; }
.ag-item.is-current .ag-body h3 { font-size: 1.125rem; }
.ag-item.is-past { opacity: .6; }
.ag-item.is-past .ag-ico svg:first-child { display: none; }
.ag-item.is-past .ag-ico .ag-tick { display: block; }
.ag-item.is-past .ag-chip { color: #fff; border: 1px solid rgba(255,255,255,.4); }
.ag-item.is-next .ag-chip { border: 1px solid var(--gold-300); color: var(--gold-200); }

/* ---------- Avatar: luồng 3 bước, thao tác một tay ---------- */
.av-head { text-align: left; }
.av-head .t-h2 { margin-top: 4px; }
.av-head .lead { margin-top: 8px; }
.av-count { position: relative; margin-top: 6px; padding-left: 16px; font-size: .875rem; font-weight: 700; line-height: 1.4; color: var(--bronze-700); text-wrap: balance; }
.av-count::before { content: ""; position: absolute; left: 0; top: .5em; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-500); }
.avatar-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.av-stage { position: relative; width: 100%; max-width: 420px; margin-inline: auto; aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 0 3px var(--gold-500), 0 14px 36px rgba(11,31,92,.25); background: #cfd9ea; }
.av-stage canvas { display: block; width: 100%; height: 100%; border-radius: 50%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.av-stage canvas:active { cursor: grabbing; }
.av-stage.is-over { box-shadow: 0 0 0 3px var(--gold-500), 0 0 0 8px rgba(255,211,92,.6); }
.av-drop { display: none; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 50%; place-items: center; background: rgba(11,31,92,.72); color: #fff; font-weight: 700; pointer-events: none; }
.av-stage.is-over .av-drop { display: grid; }
.av-hint { margin: 16px auto 0; max-width: 40ch; text-align: center; font-size: 1rem; color: var(--navy-ink); line-height: 1.5; }
.steps { display: grid; gap: 24px; }
.step { position: relative; }
.step-body { min-width: 0; }
.step-no { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--navy-ink); color: var(--gold-200); display: grid; place-items: center; font-weight: 800; font-family: var(--font-display); font-size: .9375rem; }
.step-body h3 { font-family: var(--font-display); font-size: 1.125rem; color: var(--navy-ink); line-height: 32px; padding-left: 44px; }
.step-body > p { margin-top: 4px; font-size: 1rem; line-height: 1.5; color: #26356e; }
.step-body > .btn { margin-top: 12px; }
.priv, .out-note { margin-top: 8px !important; font-size: .875rem !important; color: #3a4880 !important; }
.zoom-row { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.zoom-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.icon-btn { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--navy-ink); background: transparent; color: var(--navy-ink); font: 700 1.5rem/1 var(--font-body); cursor: pointer; }
.icon-btn:hover { background: rgba(11,31,92,.08); }
.tool-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.tool-row .btn { margin-top: 0; padding: 0 8px; }
.tool-row #avReset { grid-column: 1 / -1; }
input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; width: 0; height: 48px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--gold-300), var(--gold-500)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--gold-300), var(--gold-500)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: #fff; border: 3px solid var(--gold-500); box-shadow: 0 2px 6px rgba(11,31,92,.3); }
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--gold-500); }
.av-status { margin-top: 16px; font-weight: 600; color: var(--navy-ink); font-size: 1rem; }
.av-status:empty { display: none; }
/* Thông báo lỗi dạng thẻ */
.av-error { margin-top: 16px; position: relative; padding: 12px 14px 12px 52px; border-radius: 12px; background: #fff1ee; border: 1px solid #e8a79c; border-left: 5px solid #c0392b; color: #6e150b; font-weight: 600; font-size: .9375rem; line-height: 1.45; }
.av-error::before { content: "!"; position: absolute; left: 12px; top: 12px; width: 28px; height: 28px; border-radius: 50%; background: #c0392b; color: #fff; font-weight: 800; display: grid; place-items: center; }
.av-error:empty { display: none; }
.av-error.is-warn { background: #fff7e0; border-color: #e6c36a; border-left-color: var(--gold-500); color: #5a3a05; }
.av-error.is-warn::before { background: var(--gold-500); color: #fff; }
.av-fallback { display: block; margin-top: 12px; max-width: 240px; border-radius: 50%; }

/* Trình duyệt cũ (WebView cũ của Zalo/Facebook) chưa có aspect-ratio */
@supports not (aspect-ratio: 1) {
  .av-stage { height: 0; padding-bottom: 100%; }
  .av-stage canvas { position: absolute; top: 0; left: 0; }
  .cd-num { min-height: 54px; }
}

/* Điện thoại: thứ tự Chọn ảnh -> khung xem trước -> canh khung -> tải; mọi điều khiển nằm gần nhau trong tầm ngón cái */
@media (max-width: 767px) {
  .avatar-grid { gap: 20px; }
  .av-panel, .steps { display: contents; }
  .step:nth-child(1) { order: 1; }
  .av-stage-col { order: 2; }
  .step:nth-child(2) { order: 3; }
  .step:nth-child(3) { order: 4; }
  #avStatus, #avError, #avFallback { order: 5; margin-top: 0; }
  .tool-row { grid-template-columns: repeat(3, 1fr); }
  .tool-row #avReset { grid-column: auto; }
  .tool-row .btn { font-size: .875rem; padding: 0 4px; gap: 4px; min-height: 48px; }
  .tool-row .btn svg { width: 16px; height: 16px; }
  .av-hint { margin-top: 12px; }
  /* câu hướng dẫn ở bước 2 trùng ý với dòng gợi ý ngay dưới khung xem trước: ẩn trên điện thoại để nút Tải ảnh nằm trong một màn hình */
  .step:nth-child(2) > .step-body > p { display: none; }
}
@media (max-width: 359px) {
  .tool-row { grid-template-columns: 1fr 1fr; }
  .tool-row #avReset { grid-column: 1 / -1; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-950); color: var(--text-on-dark-muted); text-align: center; padding: 40px 0 calc(40px + var(--tab-h) + var(--safe-b)); border-top: 1px solid rgba(255,224,138,.35); font-size: 1rem; }
.footer-inner > * + * { margin-top: 6px; }
.footer-brand { margin-bottom: 14px; }
.footer-brand .logo-safi { width: 64px; height: 64px; }
.footer-brand .logo-20 { width: 68px; }
.footer-brand .brand-vline { height: 52px; }
.footer-name, .footer-inner > p:nth-of-type(n+4) { text-wrap: balance; }
.footer-name { color: #fff; font-weight: 700; font-size: 1.0625rem; }
.footer-en { color: #fff; letter-spacing: .06em; font-size: 1rem; }
.footer-script { font-size: 1.875rem; color: var(--gold-200); margin-top: 18px !important; text-shadow: none; }
.footer-priv { margin-top: 16px !important; max-width: 60ch; margin-inline: auto; font-size: .875rem; }
.footer-small { font-size: .8125rem; color: #aebde6; }

.reveal { opacity: 0; transform: translateY(10px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
html.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Màn thấp (iPhone SE, 320x568): gọn thêm để vẫn thấy nút chính ---------- */
@media (max-width: 767px) and (max-height: 700px) {
  .hero-copy { padding-top: 76px; }
  .hero-copy .t-script { font-size: 1.875rem; }
  .hero-copy .t-display { font-size: 1.375rem; }
  .hero-slogan { margin-top: 6px; }
  .hero-slogan .t-slogan { font-size: 1.25rem; }
  .tagline { display: none; }
  .cd-num { min-height: 46px; font-size: 1.625rem; }
  .cd-live-link { display: none; }
  .btn-lg { min-height: 52px; }
  .hero-dock { gap: 8px; padding-top: 22px; }
  .hero-copy { padding-bottom: 20px; }
  .hero-scrim { background: linear-gradient(180deg, rgba(3,20,72,.55) 0%, rgba(3,20,72,.2) 18%, rgba(3,20,72,.45) 36%, rgba(3,20,72,.88) 50%, rgba(3,20,72,.94) 100%); }
}
@media (max-width: 374px) and (max-height: 700px) {
  .hero-img { top: 11%; height: 89%; }
}
@media (max-width: 767px) and (min-height: 900px) {
  .btn-sec { display: inline-flex; }
  .hero-info-row small { display: block; }
}

/* ---------- Tablet >= 768: bố cục rộng hơn, thanh điều hướng lên header ---------- */
@media (min-width: 768px) {
  :root { --gutter: 32px; --section-y: 72px; --hdr: 76px; --tab-h: 0px; }
  html { scroll-padding-top: calc(var(--hdr) + 12px); }
  .tabbar { display: none; }
  .site-header { position: fixed; padding: 10px var(--gutter); background: rgba(3,20,72,.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,224,138,.25); }
  .logo-safi { width: 52px; height: 52px; }
  .logo-20 { width: 56px; }
  .brand-name { font-size: .875rem; }
  .brand-name { font-size: .8125rem; }
  .nav { display: flex; align-items: center; }
  .nav a { position: relative; display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; font-size: 1rem; font-weight: 600; text-decoration: none; color: #fff; white-space: nowrap; }
  .nav a::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 8px; height: 2px; background: var(--gold-300); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-base) var(--ease-out); }
  .nav a:hover::after, .nav a[aria-current="true"]::after { transform: scaleX(1); }

  .hero-img { object-position: 100% 28%; }
  .hero-copy, .hero-dock { background: none; }
  .hero-copy { padding: calc(var(--hdr) + 40px) var(--gutter) 0; }
  .hero-copy .t-script { font-size: 3.25rem; }
  .hero-copy .t-display { font-size: 2.5rem; }
  .hero-moc { font-size: 1rem; }
  .hero-slogan .t-slogan { font-size: 2rem; }
  .hero-dock { width: 100%; max-width: 560px; margin-inline: auto; padding-bottom: 48px; gap: 16px; }
  .tagline { font-size: 1.125rem; }
  .cd-num { min-height: 64px; font-size: 2.25rem; }
  .cd-head { font-size: 1.0625rem; }
  .btn-lg { width: 100%; }
  .btn-sec { display: inline-flex; }
  .hero-info-row small { display: block; }
  .t-h2 { font-size: 2rem; }
  .lead { font-size: 1.125rem; }
  .ag-actions { grid-template-columns: repeat(2, minmax(0, 220px)); }
  .ag-item { padding: 14px 16px; }
  .ag-body h3 { font-size: 1.125rem; }
  .avatar-grid { grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); align-items: start; gap: 40px; margin-top: 32px; }
  .av-stage-col { position: sticky; top: calc(var(--hdr) + 16px); }
  .step-body > .btn { width: auto; min-width: 260px; }
  .site-footer { padding-bottom: 48px; }
}

/* ---------- Desktop >= 1024: hero ngang, nội dung bên trái, thuyền bên phải ---------- */
@media (min-width: 1024px) {
  :root { --hdr: 84px; }
  .site-header { padding: 12px var(--gutter); }
  .logo-safi { width: 56px; height: 56px; }
  .logo-20 { width: 60px; }
  .brand-name { font-size: .875rem; }
  .bn-vi { max-width: none; }
  .bn-en { display: block; margin-top: 2px; }
  .ag-actions .btn-lg { min-width: 0; }
  .hero { min-height: max(680px, min(100vh, 1000px)); min-height: max(680px, min(100svh, 1000px)); }
  .hero-img { object-position: 50% 50%; }
  .hero-scrim { background: linear-gradient(90deg, rgba(3,20,72,.78) 0%, rgba(3,20,72,.62) 36%, rgba(3,20,72,0) 62%), linear-gradient(180deg, rgba(3,20,72,.4) 0%, rgba(3,20,72,0) 18%); }
  .hero-copy, .hero-dock { margin-inline: 0; width: 100%; max-width: calc(var(--container)); margin-left: auto; margin-right: auto; }
  .hero-copy { text-align: left; padding: calc(var(--hdr) + 28px) var(--gutter) 0; }
  .hero-copy > * { max-width: 720px; }
  .hero-dock > * { max-width: 640px; }
  .hero-dock > .countdown { max-width: 560px; }
  .hero-copy .t-script { font-size: 3.5rem; }
  .hero-copy .t-display { font-size: clamp(2.5rem, 3.5vw, 3.5rem); white-space: nowrap; }
  .hero-moc { font-size: 1.0625rem; margin-top: 10px; }
  .hero-slogan { margin-top: 16px; }
  .hero-slogan .t-slogan { font-size: clamp(2rem, 3.2vw, 2.75rem); }
  .hero-soar { display: block; margin-top: 4px; font-size: 1.375rem; }
  .hero-dock { padding: 20px var(--gutter) 40px; gap: 14px; }
  .tagline { text-align: left; margin-inline: 0; max-width: 640px; font-size: 1.25rem; text-wrap: initial; background: none; padding: 0; text-shadow: var(--text-shadow-white); }
  .countdown { text-align: left; padding: 16px 20px 14px; }
  .cd-clock { max-width: 460px; }
  .cd-eyebrow { display: block; }
  .cd-eyebrow + .cd-head { margin-top: 4px; }
  .cta-row { display: flex; gap: 12px; align-items: center; }
  .btn-lg { width: auto; min-width: 260px; }
  .btn-sec { min-height: 56px; }
  .agenda-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: start; }
  .agenda-side { position: sticky; top: calc(var(--hdr) + 24px); }
  .avatar-grid { grid-template-columns: 440px minmax(0, 1fr); gap: 64px; }
  .av-stage { max-width: 440px; }
}
@media (min-width: 1200px) {
  :root { --gutter: 48px; --section-y: 96px; }
  .t-h2 { font-size: 2.25rem; }
}
@media (max-width: 359px) {
  .cd-num { font-size: 1.625rem; }
  .hero-info-row strong { font-size: .9375rem; }
  .cd-head { font-size: .875rem; }
  .btn-lg { font-size: 1rem; }
}

/* ---------- Điện thoại xoay ngang (844x390, 667x375): hero 2 cột, đủ nút chính + đếm ngược trong một màn ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --hdr: 0px; --tab-h: 0px; }
  html { scroll-padding-top: 12px; }
  .tabbar { display: none; }
  .site-header { position: relative; background: #051e69; border-bottom: 1px solid rgba(255,224,138,.25); -webkit-backdrop-filter: none; backdrop-filter: none; padding: 6px max(var(--gutter), env(safe-area-inset-left)) 6px max(var(--gutter), env(safe-area-inset-right)); }
  .logo-safi { width: 40px; height: 40px; }
  .logo-20 { width: 44px; }
  .brand-vline { height: 32px; }
  .brand-name { display: none; }
  .nav { display: flex; }
  .nav a { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: .9375rem; font-weight: 600; color: #fff; text-decoration: none; white-space: nowrap; }
  .nav a:hover::after, .nav a[aria-current="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 6px; height: 2px; background: var(--gold-300); }
  .hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: start; column-gap: 20px; min-height: 0; padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right)); }
  .hero-img { object-position: 85% 40%; }
  .hero-scrim { background: linear-gradient(90deg, rgba(3,20,72,.7) 0%, rgba(3,20,72,.3) 50%, rgba(3,20,72,0) 100%), linear-gradient(0deg, rgba(3,20,72,.6) 0%, rgba(3,20,72,0) 35%); }
  .hero-copy { padding: 16px 0 0; text-align: left; align-self: start; background: none; }
  .hero-copy .t-script { font-size: 1.875rem; }
  .hero-copy .t-display { font-size: 1.5rem; white-space: nowrap; }
  .hero-slogan { margin-top: 8px; }
  .hero-slogan .t-slogan { font-size: 1.25rem; }
  .hero-dock { margin: 0; max-width: none; width: auto; padding: 12px 0 14px; gap: 8px; align-self: start; background: none; }
  .tagline { display: none; }
  .hero-info-row small, .cd-eyebrow { display: none; }
  .countdown { padding: 8px 10px 6px; }
  .cd-clock { margin-top: 6px; }
  .cd-num { min-height: 40px; font-size: 1.5rem; }
  .cd-lab { margin-top: 2px; }
  .cd-tz { margin-top: 2px; }
  .btn-lg { min-height: 48px; width: 100%; min-width: 0; }
  .btn-sec { display: none; }
  .site-footer { padding-bottom: 40px; }
}
@media (orientation: landscape) and (max-height: 500px) and (min-width: 800px) { .brand-name { display: flex; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .tabbar { transition: none; }
  .nav a::after { transition: none; }
}
@media (forced-colors: active) {
  .ag-item.is-current { outline: 2px solid Highlight; }
}
