/* nghiemlab.vn — một file CSS cho mọi trang. Màu, cỡ, khoảng cách đều lấy từ token dưới đây. */

@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/assets/fonts/be-vietnam-pro-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/assets/fonts/be-vietnam-pro-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Màu — sáng */
  --bg: #ffffff;
  --surface: #f8fafc;
  --band: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --on-accent: #ffffff;
  --accent-soft: #dbeafe;
  --on-accent-soft: #1e3a8a;
  --mark: #3b82f6;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 8px 24px rgb(15 23 42 / 0.08);

  /* Chữ */
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-sm: 0.875rem;
  --fs-base: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  --fs-md: 1.25rem;
  --fs-lg: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  --fs-xl: clamp(2.125rem, 1.6rem + 2.2vw, 3.25rem);
  --fs-display: clamp(2.75rem, 1.7rem + 4.2vw, 4.75rem);

  /* Khoảng cách (lưới 4) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;

  --gutter: 20px;
  --max: 1120px;
  --radius: 12px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --t-fast: 150ms;
  --t: 220ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #16213a;
    --band: #131c31;
    --line: #24304a;
    --line-strong: #3a4862;
    --text: #f1f5f9;
    --muted: #a3b1c6;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --on-accent: #0f172a;
    --accent-soft: #1d3461;
    --on-accent-soft: #dbeafe;
    --mark: #60a5fa;
    --focus: #93c5fd;
    --shadow: 0 1px 2px rgb(2 6 23 / 0.5), 0 12px 32px rgb(2 6 23 / 0.45);
  }
}

@media (min-width: 768px) {
  :root { --gutter: 32px; }
}

/* Nền */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
main { flex: 1 0 auto; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
p { text-wrap: pretty; }
img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.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;
}
.icon { width: 1.125em; height: 1.125em; flex: none; }

/* Đầu trang */
.site-head { padding-block: var(--s-4); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); min-height: 56px; }
.site-head--home .wrap { justify-content: flex-end; }
.brand { display: inline-flex; align-items: center; min-height: 44px; margin-left: -6px; border-radius: 6px; }
.brand img { height: 36px; width: auto; }
.nav { display: flex; gap: var(--s-2); }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: var(--s-3);
  border-radius: var(--radius-sm); color: var(--text); font-weight: 600; font-size: var(--fs-sm);
  text-decoration: none; transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.nav a:hover { background: var(--band); color: var(--text); }
.nav a[aria-current="page"] { color: var(--muted); }
.nav a[aria-current="page"]:hover { color: var(--text); }

/* Trang chủ: phần mở đầu */
.hero { padding-block: var(--s-8) var(--s-8); }
.lockup { display: flex; align-items: center; gap: clamp(12px, 1.4vw, 20px); }
.lockup .mark { width: calc(var(--fs-display) * 1.12); height: auto; color: var(--mark); }
.lockup h1 { font-size: var(--fs-display); letter-spacing: -0.025em; line-height: 1; }
.lead { margin-top: var(--s-5); font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem); line-height: 1.45; color: var(--muted); max-width: 34ch; text-wrap: balance; }

/* Khối mục */
.section { padding-block: var(--s-8); }
.section-title { font-size: var(--fs-lg); margin-bottom: var(--s-6); }
.note { margin-top: var(--s-6); color: var(--muted); font-size: var(--fs-sm); }

/* Thẻ lab */
.labs { display: grid; gap: var(--s-7); }
.lab { position: relative; display: grid; gap: var(--s-4); align-content: start; }
.frame {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface);
  transition: transform var(--t) var(--ease), border-color var(--t) var(--ease);
}
.frame img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.lab h3 { font-size: var(--fs-md); display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--s-2); }
.lab .subj { font-size: var(--fs-sm); font-weight: 400; color: var(--muted); letter-spacing: 0; }
.lab p { color: var(--muted); }
.go {
  display: inline-flex; align-items: center; gap: var(--s-2); justify-self: start;
  min-height: 44px; font-weight: 600; text-decoration: none; color: var(--accent);
}
.go .icon { transition: transform var(--t) var(--ease); }
.go::after { content: ""; position: absolute; inset: -12px; border-radius: calc(var(--radius) + 6px); }
.go:focus-visible { outline: none; }
.go:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 0; }
.lab:hover .frame { transform: translateY(-2px); border-color: var(--line-strong); }
.lab:hover .go { color: var(--accent-hover); text-decoration: underline; }
.lab:hover .go .icon { transform: translate(2px, -2px); }
.lab:active .frame { transform: translateY(0); }

@media (min-width: 640px) and (max-width: 959.98px) {
  .lab { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: var(--s-6); align-items: center; }
  .lab .frame { grid-row: 1 / span 3; }
}
@media (min-width: 960px) {
  .labs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-6); }
}

/* Dải "Cho giáo viên" ở trang chủ */
.band { background: var(--band); border-block: 1px solid var(--line); }
.teach { position: relative; display: grid; gap: var(--s-6); padding-block: var(--s-8) 0; overflow: hidden; }
.teach h2 { font-size: var(--fs-lg); }
.teach h2 a { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: var(--s-3); }
.teach h2 a .icon { color: var(--accent); width: 0.9em; height: 0.9em; transition: transform var(--t) var(--ease); }
.teach h2 a::after { content: ""; position: absolute; inset: 0; }
.teach h2 a:focus-visible { outline: none; }
.teach h2 a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: var(--radius); }
.teach p { margin-top: var(--s-4); color: var(--muted); max-width: 52ch; }
.teach .text { padding-bottom: 0; }
.teach .paper {
  justify-self: center; width: min(100%, 360px); height: 220px; overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0; border: 1px solid var(--line); border-bottom: 0;
  box-shadow: var(--shadow); background: #fff;
  transition: transform var(--t) var(--ease);
}
.teach .paper img { width: 100%; }
.teach:hover .paper { transform: translateY(-4px); }
.teach:hover h2 a .icon { transform: translateX(3px); }
.teach:hover h2 a { color: var(--text); }
@media (min-width: 768px) {
  .teach { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; padding-top: var(--s-8); }
  .teach .text { padding-bottom: var(--s-8); align-self: center; }
  .teach .paper { height: 260px; justify-self: end; }
}

/* Chân trang */
.site-foot { border-top: 1px solid var(--line); padding-block: var(--s-7); color: var(--muted); font-size: var(--fs-sm); }
.band + .site-foot { border-top: 0; }
.site-foot .wrap { display: grid; gap: var(--s-5); }
.site-foot .mini { height: 28px; width: auto; }
.site-foot ul { display: grid; gap: var(--s-2); }
.site-foot a { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); display: inline-block; padding-block: 12px; margin-block: -12px; }
.site-foot a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
@media (min-width: 768px) {
  .site-foot .wrap { grid-template-columns: auto 1fr; column-gap: var(--s-9); align-items: start; }
}

/* Trang con: đầu trang nội dung */
.page-head { padding-block: var(--s-7) var(--s-6); }
.page-head h1 { font-size: var(--fs-xl); letter-spacing: -0.02em; }
.page-head .sub { margin-top: var(--s-3); color: var(--muted); font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem); }
.page-head .intro { margin-top: var(--s-5); max-width: 62ch; font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem); color: var(--text); }
.back {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; margin-bottom: var(--s-4);
  color: var(--muted); font-size: var(--fs-sm); font-weight: 600; text-decoration: none;
}
.back:hover { color: var(--text); }
.back .icon { transition: transform var(--t) var(--ease); }
.back:hover .icon { transform: translateX(-2px); }

/* Danh sách phiếu */
.sheets { display: grid; gap: var(--s-4); padding-bottom: var(--s-9); }
.sheet-item {
  position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: var(--s-5); align-items: center;
  padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}
.sheet-item .thumb { width: 96px; height: 72px; overflow: hidden; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.sheet-item .thumb img { width: 100%; }
.sheet-item h3 { font-size: var(--fs-md); }
.sheet-item h3 a { color: var(--text); text-decoration: none; }
.sheet-item h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.sheet-item h3 a:focus-visible { outline: none; }
.sheet-item h3 a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.sheet-item .meta { margin-top: var(--s-1); color: var(--muted); font-size: var(--fs-sm); }
.sheet-item > .icon { color: var(--accent); width: 22px; height: 22px; transition: transform var(--t) var(--ease); }
.sheet-item:hover { border-color: var(--line-strong); background: var(--surface); }
.sheet-item:hover > .icon { transform: translateX(3px); }
@media (min-width: 640px) {
  .sheet-item { grid-template-columns: 144px minmax(0, 1fr) auto; padding: var(--s-5); gap: var(--s-6); }
  .sheet-item .thumb { width: 144px; height: 104px; }
}

/* Trang phiếu */
.sheet { display: grid; gap: var(--s-7); grid-template-areas: "act" "pv" "more"; padding-bottom: var(--s-9); }
.sheet-act { grid-area: act; display: grid; gap: var(--s-7); align-content: start; }
.sheet-pv { grid-area: pv; }
.sheet-more { grid-area: more; display: grid; gap: var(--s-7); align-content: start; }
.sheet-pv figure {
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); background: #fff;
  max-width: 440px; margin-inline: auto;
}
@media (min-width: 900px) {
  .sheet { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "pv act" "pv more"; column-gap: var(--s-9); row-gap: var(--s-7); }
  .sheet-pv { align-self: start; position: sticky; top: var(--s-5); }
  .sheet-pv figure { max-width: none; }
}
.h2 { font-size: var(--fs-md); margin-bottom: var(--s-4); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-3);
  min-height: 52px; padding: var(--s-3) var(--s-5); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; line-height: 1.3;
  transition: background-color var(--t) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn:active { transform: translateY(1px); }
@media (max-width: 479.98px) { .btn { width: 100%; } }

.docs { display: grid; border-top: 1px solid var(--line); }
.doc { display: grid; gap: var(--s-3); padding-block: var(--s-4); border-bottom: 1px solid var(--line); }
.doc-name { font-weight: 600; }
.doc-files { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.file {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: var(--s-2) var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
  font-size: var(--fs-sm); font-variant-numeric: tabular-nums;
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease), transform var(--t-fast) var(--ease);
}
.file b { font-weight: 600; }
.file .size { color: var(--muted); }
.file .icon { color: var(--accent); }
.file:hover { border-color: var(--accent); background: var(--surface); color: var(--text); }
.file:active { transform: translateY(1px); }
@media (min-width: 560px) {
  .doc { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
}

.timeline-bar { display: flex; gap: 3px; margin-bottom: var(--s-5); }
.timeline-bar span {
  display: grid; place-items: center; height: 28px; border-radius: 6px;
  background: var(--accent-soft); color: var(--on-accent-soft); font-size: 0.8125rem; font-weight: 600;
}
.steps { display: grid; counter-reset: step; }
.steps li {
  counter-increment: step; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--s-3);
  align-items: baseline; padding-block: var(--s-3); border-bottom: 1px solid var(--line);
}
.steps li:first-child { border-top: 1px solid var(--line); }
.steps li::before { content: counter(step) "."; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.steps .min { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }

.notes { display: grid; gap: var(--s-3); color: var(--muted); max-width: 60ch; }

/* 404 */
.missing { padding-block: var(--s-9) var(--s-10); }
.missing h1 { font-size: var(--fs-xl); }
.missing p { margin-top: var(--s-5); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .lab:hover .frame, .teach:hover .paper { transform: none; }
}
