/* Trang web Gallery của Quanta. Tông tối theo brand (docs/store/brand: nền #0f0f14, gradient #5b3df5 → #a86bff → #ff7aa8).
   Mobile trước; font hệ thống (không tải font ngoài); không style inline (CSP style-src 'self'). */
:root {
  --bg: #0f0f14;
  --surface: #17161f;
  --surface-2: #1f1d2a;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f2fa;
  --muted: #bdb8d0;
  --dim: #9893ad;
  --violet: #5b3df5;
  --purple: #a86bff;
  --pink: #ff7aa8;
  --focus: #d8c2ff;
  --brand: linear-gradient(135deg, #5b3df5 0%, #a86bff 55%, #ff7aa8 100%);
  --btn: linear-gradient(135deg, #5b3df5 0%, #8b4dff 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 5vw + 0.6rem, 3.25rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 1.5vw + 0.9rem, 1.75rem); font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
img, video, svg { display: block; max-width: 100%; }
a { color: var(--focus); text-underline-offset: 3px; }
a:hover { color: #fff; }
code {
  font: 0.9em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08em 0.4em;
  overflow-wrap: anywhere;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  background: #fff; color: #111; padding: 10px 14px; border-radius: 8px; font-weight: 700;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

/* --- Nút --------------------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.32); }
.btn-primary { background: var(--btn); border-color: transparent; color: #fff; box-shadow: 0 8px 24px rgba(91, 61, 245, 0.35); }
.btn-primary:hover { box-shadow: 0 10px 30px rgba(139, 77, 255, 0.5); transform: translateY(-1px); }
.btn-primary[aria-busy="true"] { cursor: progress; opacity: 0.85; }
.btn-ghost { background: transparent; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1.05rem; }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 0.9rem; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--focus);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* --- Header / footer -------------------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(15, 15, 20, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 9px; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand-sub { display: none; color: var(--dim); font-size: 0.9rem; padding-left: 10px; border-left: 1px solid var(--line-strong); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a:not(.btn) {
  display: none; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  padding: 8px 10px; border-radius: 8px;
}
.nav a:not(.btn):hover { color: #fff; background: var(--surface-2); }
@media (min-width: 640px) {
  .brand-sub { display: inline; }
  .nav a:not(.btn) { display: inline-block; }
}

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 40px; color: var(--dim); font-size: 0.9rem; }
.footer-row { display: grid; gap: 12px; }
.footer-row p { margin: 0; max-width: 60ch; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-nav a { color: var(--muted); }
@media (min-width: 860px) { .footer-row { grid-template-columns: 1fr auto; align-items: center; } }

/* --- Hero ------------------------------------------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding: 56px 0 40px; isolation: isolate; }
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.hero::before {
  width: 720px; height: 720px; left: -260px; top: -380px;
  background: radial-gradient(closest-side, rgba(109, 74, 255, 0.45), rgba(15, 15, 20, 0));
}
.hero::after {
  width: 560px; height: 220px; right: -160px; top: 40px;
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  transform: rotate(-22deg);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.015);
}
.eyebrow {
  display: inline-block; margin: 0 0 12px;
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 { max-width: 18ch; }
.lead { color: var(--muted); font-size: clamp(1.02rem, 0.5vw + 0.95rem, 1.2rem); max-width: 62ch; }
.promises { list-style: none; padding: 0; margin: 20px 0 28px; display: flex; flex-wrap: wrap; gap: 8px; }
.promises li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  font-size: 0.93rem; font-weight: 600;
}
.check { width: 18px; height: 18px; color: var(--pink); flex: none; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
@media (min-width: 860px) { .hero { padding: 88px 0 56px; } }

/* --- Gallery: lọc + lưới ---------------------------------------------------------------------------------- */
.gallery { padding: 24px 0 8px; scroll-margin-top: 64px; }
.gallery-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.count { color: var(--dim); margin: 0; font-variant-numeric: tabular-nums; }
.filters { display: grid; gap: 14px; margin: 8px 0 22px; }
.search { position: relative; max-width: 460px; }
.search-icon { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--dim); pointer-events: none; }
.search input {
  width: 100%; min-height: 46px; padding: 10px 14px 10px 42px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit;
}
.search input::placeholder { color: var(--dim); }
.search input:focus-visible { border-color: var(--purple); outline-offset: 2px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: -4px -2px 0; scrollbar-width: thin; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--muted);
  font: inherit; font-size: 0.93rem; font-weight: 650; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { color: #fff; border-color: rgba(255, 255, 255, 0.32); }
.chip[aria-pressed="true"] { background: #fff; color: #15131d; border-color: #fff; }
.chip-n { font-size: 0.8rem; opacity: 0.7; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 24px 0; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { display: flex; }
.card-link {
  display: flex; flex-direction: column; width: 100%;
  color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card-link:hover { border-color: rgba(168, 107, 255, 0.55); box-shadow: var(--shadow); transform: translateY(-3px); color: inherit; }
.card-link:focus-visible { outline-offset: 2px; border-radius: var(--radius); }
.card-media { position: relative; aspect-ratio: 3 / 4; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card-link:hover .card-media img { transform: scale(1.04); }
.badge {
  position: absolute; left: 10px; bottom: 10px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(10, 10, 14, 0.72); border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.card-body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-cat { margin: 0; color: var(--purple); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.card-title { margin: 0; font-size: 1rem; }
.card-sum {
  margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .tags { margin-top: auto; padding-top: 8px; }
@media (max-width: 479px) {
  .card .tags { display: none; }
  .card-sum { -webkit-line-clamp: 2; }
}

.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  padding: 2px 9px; border-radius: 999px;
  background: rgba(168, 107, 255, 0.12); color: #d9c8ff;
  font-size: 0.78rem; font-weight: 600;
}
.tags li::before { content: "#"; opacity: 0.6; }

/* Ảnh giữ chỗ khi mẫu chưa có media (catalog media: null): gradient theo nhóm, icon + chữ. */
.ph {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px; text-align: center; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(120% 80% at 20% 10%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 60%),
    linear-gradient(160deg, var(--ph-a, #3b2a8f), var(--ph-b, #1a1530));
}
.ph::before, .ph::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.1); pointer-events: none;
}
.ph::before { width: 140%; height: 45%; transform: rotate(-24deg); }
.ph::after { width: 100%; height: 30%; transform: rotate(18deg); border-color: rgba(255, 255, 255, 0.07); }
.ph-icon {
  width: 44px; height: 44px; padding: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14); color: #fff;
}
.ph-cat { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.78); }
.ph-text { font-size: 0.88rem; font-weight: 650; color: #fff; }
.ph-trend { --ph-a: #5b3df5; --ph-b: #24133f; }
.ph-remix { --ph-a: #8b4dff; --ph-b: #1b1238; }
.ph-product { --ph-a: #b14d8f; --ph-b: #22122a; }
.ph-food { --ph-a: #c0613d; --ph-b: #2a1512; }
.ph-ugc { --ph-a: #d0558a; --ph-b: #2a1222; }
.ph-social { --ph-a: #3d6ad0; --ph-b: #121a33; }

/* --- Cách dùng -------------------------------------------------------------------------------------------- */
.how { padding: 56px 0 0; }
.steps { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; }
.steps li { position: relative; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.steps p { margin: 0; color: var(--muted); }
.step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin-bottom: 12px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800;
}
@media (min-width: 860px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

/* --- Trang một mẫu ---------------------------------------------------------------------------------------- */
.recipe { padding-top: 20px; }
.crumbs ol { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; color: var(--dim); font-size: 0.9rem; }
.crumbs li:not(:last-child)::after { content: "›"; margin-left: 6px; opacity: 0.7; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }

.recipe-grid { display: grid; gap: 28px; }
.recipe-media {
  --w: 0.5625;
  position: relative; justify-self: center;
  width: min(100%, calc(62vh * var(--w)));
  border-radius: 20px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.recipe-media.ratio-9x16 { aspect-ratio: 9 / 16; --w: 0.5625; }
.recipe-media.ratio-3x4 { aspect-ratio: 3 / 4; --w: 0.75; }
.recipe-media.ratio-1x1 { aspect-ratio: 1 / 1; --w: 1; }
.recipe-media.ratio-16x9 { aspect-ratio: 16 / 9; --w: 1.7778; }
.media-el { width: 100%; height: 100%; object-fit: cover; background: #000; }
.recipe-media .ph-icon { width: 64px; height: 64px; padding: 16px; }
.recipe-media .ph-text { font-size: 1rem; }
@media (min-width: 900px) {
  .recipe-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; align-items: start; }
  .recipe-media { position: sticky; top: 84px; justify-self: stretch; width: auto; max-height: calc(100vh - 110px); }
  .recipe-media.ratio-9x16 { width: min(100%, calc((100vh - 110px) * 0.5625)); justify-self: center; }
}
.recipe-info h1 { font-size: clamp(1.7rem, 3vw + 0.8rem, 2.6rem); }
.facts { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); font-size: 0.88rem; font-weight: 600; }

.use { margin: 4px 0 28px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.use .btn-primary { width: 100%; }
@media (min-width: 520px) { .use .btn-primary { width: auto; } }
.use-status { margin: 12px 0 0; color: var(--muted); font-size: 0.93rem; min-height: 1.5em; }
.use-status:empty { min-height: 0; margin: 0; }
.install { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.install:focus { outline: none; }
.install:focus-visible { outline: 3px solid var(--focus); outline-offset: 6px; }
.install-title { font-size: 1.1rem; }
.install ol { margin: 0 0 12px; padding-left: 1.3em; color: var(--muted); }
.install li { margin-bottom: 6px; }
.note { margin: 0; color: var(--dim); font-size: 0.88rem; }

.block { padding: 18px 0; border-top: 1px solid var(--line); }
.block h2 { font-size: 1.1rem; margin-bottom: 10px; }
.block p { color: var(--muted); }
.block p:last-child { margin-bottom: 0; }
.block strong { color: var(--text); }
.inputs { margin: 0 0 12px; padding: 0; list-style: none; counter-reset: inp; display: grid; gap: 10px; }
.inputs li {
  counter-increment: inp; position: relative; display: grid; gap: 2px;
  padding: 12px 14px 12px 50px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line);
}
.inputs li::before {
  content: counter(inp); position: absolute; left: 14px; top: 12px;
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(168, 107, 255, 0.18); color: #e2d4ff; font-size: 0.8rem; font-weight: 800;
}
.inputs span { color: var(--muted); font-size: 0.9rem; }
.hint { font-size: 0.9rem; }

.more { margin-top: 48px; }
@media (min-width: 1040px) { .grid-more { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* --- Privacy (Markdown) ----------------------------------------------------------------------------------- */
.prose { max-width: 820px; padding-top: 32px; }
.prose h1 { font-size: clamp(1.7rem, 3vw + 0.8rem, 2.4rem); }
.prose h2 { margin-top: 1.8em; }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.prose table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.92rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { background: var(--surface-2); color: var(--text); font-weight: 700; }
.prose td { color: var(--muted); }
.prose tr:last-child td { border-bottom: 0; }
.site-note { margin: 32px 0; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid rgba(168, 107, 255, 0.35); }
.site-note h2 { margin: 0 0 8px; font-size: 1.05rem; }
.site-note p { margin: 0; }

/* --- 404 -------------------------------------------------------------------------------------------------- */
.notfound { padding-top: 72px; text-align: center; }
.notfound .lead { margin-left: auto; margin-right: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .card-link:hover, .btn-primary:hover, .card-link:hover .card-media img { transform: none; }
}
