/* ==========================================================================
   BAP Smart Factory — Reset / base
   Cần nạp SAU variables.css.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
  text-wrap-style: pretty;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.15;
  text-wrap: balance;
}

p { text-wrap: pretty; overflow-wrap: break-word; }

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}
img, video { height: auto; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }

a { color: inherit; text-decoration: none; }

ul[role="list"], ol[role="list"], nav ul, nav ol { list-style: none; padding: 0; }

table { border-collapse: collapse; border-spacing: 0; }

textarea { resize: vertical; }

hr { border: 0; border-top: 1px solid var(--color-border); height: 0; }

fieldset { border: 0; padding: 0; min-inline-size: 0; }

[hidden] { display: none !important; }

/* Anchor offset cho sticky header */
:target, [id] { scroll-margin-top: calc(var(--header-h) + 12px); }

/* Focus */
:focus-visible {
  outline: 3px solid var(--bap);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Accordion (<details><summary class="fq">) */
summary.fq { list-style: none; cursor: pointer; }
summary.fq::-webkit-details-marker { display: none; }
summary.fq::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--bap-dark);
  flex: none;
}
details[open] summary.fq::after { content: "−"; }

/* Select: mũi tên tùy chỉnh */
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--night-muted) 50%),
    linear-gradient(135deg, var(--night-muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

/* Animations dùng trong sơ đồ SVG */
@keyframes flow { to { stroke-dashoffset: -12; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes fillpulse { 0%, 100% { opacity: 1; } 50% { opacity: .75; } }
.flow { stroke-dasharray: 5 7; animation: flow 1.3s linear infinite; }
.flow.slow { animation-duration: 2.2s; }

/* Giảm chuyển động */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Lenis smooth scroll (bắt buộc, tránh xung đột với scroll-behavior) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }