/* demo.aword.vn — trang danh sách + khung xem demo. Màu thương hiệu AWord (kem – đất nung). */
:root {
  --bg: #FAF9F5; --surface: #FFFFFF; --ink: #1F1E1B; --muted: #6B675E; --line: #E6E2D8;
  --brand: #A84E24; --brand-ink: #FFFFFF; --brand-soft: #F6E7DE; --accent: #F0B294;
  --stage: #EDEAE2; --shadow: 0 1px 2px rgba(31,30,27,.06), 0 8px 24px rgba(31,30,27,.07);
  --r: 12px; --bar: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1A17; --surface: #24231F; --ink: #F2EFE7; --muted: #A8A397; --line: #3A3832;
    --brand: #D9774A; --brand-soft: #3A2A21; --stage: #141311; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1A17; --surface: #24231F; --ink: #F2EFE7; --muted: #A8A397; --line: #3A3832;
  --brand: #D9774A; --brand-soft: #3A2A21; --stage: #141311; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Đầu trang danh sách ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top__in { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.brand img { width: 32px; height: 32px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; letter-spacing: 0; }
.top nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--muted); }
.btn--brand { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn--brand:hover { filter: brightness(1.06); border-color: var(--brand); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface); border-color: var(--line); }

.hero { padding: 64px 0 28px; }
.hero h1 { margin: 0 0 12px; font-size: clamp(30px, 5vw, 48px); line-height: 1.12; letter-spacing: -.025em; font-weight: 600; max-width: 22ch; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { margin: 0; color: var(--muted); font-size: 17px; max-width: 62ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip span { color: var(--muted); margin-left: 4px; }
.chip[aria-pressed="true"] span { color: inherit; opacity: .7; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 24px; padding: 24px 0 72px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); }
.card__shot { position: relative; aspect-ratio: 16 / 10; background: var(--stage); overflow: hidden; display: block; }
.card__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .5s; }
.card:hover .card__shot img { transform: scale(1.03); }
.card__badge { position: absolute; top: 12px; left: 12px; background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.card__year { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.card__body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.card h2 small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 2px; letter-spacing: 0; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.card__gia { font-size: 14px; color: var(--muted); }
.card__gia b { color: var(--ink); font-weight: 600; }
.card__gia a { color: var(--brand); }
.dlg__list a.dlg__main { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.dlg__list a.dlg__main small { color: inherit; opacity: .85; }
.card__act { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.empty { padding: 48px 0; color: var(--muted); }

.foot { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.foot a { color: var(--ink); }

/* ---------- Khung xem demo ---------- */
body.viewer { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.vbar { height: var(--bar); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 30; }
.vbar__group { display: flex; align-items: center; gap: 6px; }
.vbar__mid { margin-inline: auto; }
.vbar .brand img { width: 30px; height: 30px; }
.pick { display: flex; align-items: center; gap: 10px; height: 44px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; text-align: left; min-width: 0; }
.pick img { width: 52px; height: 34px; border-radius: 6px; object-fit: cover; object-position: top; }
.pick span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pick small { color: var(--muted); font-size: 11px; }
.pick b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.ibtn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); text-decoration: none; }
.ibtn:hover { background: var(--bg); color: var(--ink); border-color: var(--line); }
.ibtn:disabled { opacity: .35; cursor: default; background: transparent; border-color: transparent; }
.seg { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.seg button { height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--brand); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button:hover { color: var(--ink); }
.msel { display: none; height: 38px; max-width: 150px; padding: 0 28px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; }
.menu { position: absolute; top: calc(var(--bar) - 4px); left: 60px; width: min(420px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.menu a { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 8px; text-decoration: none; }
.menu a:hover, .menu a[aria-current="true"] { background: var(--bg); }
.menu img { width: 80px; height: 50px; border-radius: 6px; object-fit: cover; object-position: top; flex: none; }
.menu b { display: block; font-size: 14px; }
.menu small { color: var(--muted); font-size: 12px; }
.menu .all { justify-content: center; color: var(--brand); font-weight: 500; font-size: 14px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; }

.stage { flex: 1; min-height: 0; background: var(--stage); display: flex; justify-content: center; align-items: flex-start; overflow: auto; position: relative; }
.frame { width: 100%; height: 100%; border: 0; background: #fff; display: block; transition: width .3s ease, height .3s ease; }
.stage[data-device="tablet"], .stage[data-device="phone"] { padding: 24px 16px; }
.stage[data-device="tablet"] .frame { width: 820px; height: min(1180px, 100%); border-radius: 18px; box-shadow: 0 0 0 10px #1F1E1B, var(--shadow); }
.stage[data-device="phone"] .frame { width: 390px; height: min(844px, 100%); border-radius: 28px; box-shadow: 0 0 0 10px #1F1E1B, var(--shadow); }
.note { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.note button { border: 0; background: transparent; color: inherit; cursor: pointer; opacity: .7; font-size: 16px; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }

/* Hộp liên hệ */
.dlg { border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dlg::backdrop { background: rgba(20,19,17,.45); }
.dlg__in { padding: 24px; display: grid; gap: 14px; }
.dlg h3 { margin: 0; font-size: 20px; }
.dlg p { margin: 0; color: var(--muted); font-size: 14px; }
.dlg__list { display: grid; gap: 8px; }
.dlg__list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.dlg__list a:hover { border-color: var(--brand); }
.dlg__list small { display: block; color: var(--muted); font-size: 12px; }
.dlg__x { justify-self: end; }

@media (max-width: 1100px) { .vbar .lbl { display: none; } .seg button { padding: 0 10px; } }
@media (max-width: 860px) {
  .vbar__devices, .vbar .brand span { display: none; }
  .pick b { max-width: 140px; }
}
@media (max-width: 640px) {
  :root { --bar: 56px; }
  .vbar { gap: 6px; padding: 0 8px; }
  .vbar__nav, .vbar__reload { display: none; }
  .pick img { display: none; }
  .pick b { max-width: 96px; }
  .vbar #modes { display: none; }
  .msel:not([hidden]) { display: block; }
  .vbar .brand { display: none; }
  .note { bottom: 10px; font-size: 13px; width: calc(100% - 24px); }
  .pick { padding-left: 10px; height: 40px; }
  .seg button { height: 30px; font-size: 13px; padding: 0 9px; }
  .vbar__cta .btn { font-size: 0; gap: 0; width: 38px; height: 38px; padding: 0; justify-content: center; }
  .msel { max-width: 132px; }
  .vbar__mid { margin-inline: 0 auto; }
  .hero { padding-top: 40px; }
  .top nav .btn--ghost { display: none; }
  .stage[data-device] { padding: 0; }
  .stage .frame { width: 100% !important; height: 100% !important; border-radius: 0 !important; box-shadow: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
