/* Arvyon Labs: night indigo, lavender haze, ember. Colours come from the
   Danh Tướng Tam Quốc fortress art; the pixel grid comes from the game's
   internet-café era. */
:root {
  --night: #15142A;
  --night-2: #1D1B38;
  --dusk: #2A2F55;
  --haze: #E7E5F0;
  --haze-ink: #44425E;
  --ember: #FF6A2A;
  --flame: #FFC14D;
  --text: #ECEAF6;
  --dim: #A7A4C4;
  --rule: rgb(231 229 240 / 0.14);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 3.4vw, 52px);
  --notch: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--flame); outline-offset: 3px; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  background: var(--flame); color: var(--night); padding: 10px 14px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* Square status light: a single pixel, not a dot. */
.pip { display: inline-block; width: 8px; height: 8px; background: var(--flame); flex: none; }

/* Buttons with notched, pixel-cut corners. */
.btn {
  --n: var(--notch);
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0.8rem 1.35rem;
  font-weight: 600; font-size: 0.98rem; line-height: 1.2; text-decoration: none;
  clip-path: polygon(var(--n) 0, calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n),
    100% calc(100% - var(--n)), calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%,
    var(--n) 100%, var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n)), 0 var(--n), var(--n) var(--n));
  transition: background-color 0.15s steps(2), color 0.15s steps(2);
}
.btn-ember { background: var(--ember); color: var(--night); }
.btn-ember:hover { background: var(--flame); }
.btn-line { background: rgb(231 229 240 / 0.12); color: var(--haze); box-shadow: inset 0 0 0 2px rgb(231 229 240 / 0.55); }
.btn-line:hover { background: var(--haze); color: var(--night); }
.btn:focus-visible { outline: none; background: var(--flame); color: var(--night); }

/* ---------- Header ---------- */
.top {
  position: absolute; inset: 0 0 auto; z-index: 5;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 22px var(--gutter);
  font-size: 0.92rem;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.mark { height: 22px; width: auto; color: var(--ember); }
.status { display: flex; align-items: center; gap: 10px; }
.status a { text-decoration: none; }
.status a:hover { text-decoration: underline; text-underline-offset: 4px; }
.top nav { justify-self: end; white-space: nowrap; }
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--flame); }
.sep { color: var(--dim); margin: 0 0.55rem; }
@media (max-width: 820px) {
  .top { grid-template-columns: 1fr auto; }
  .status { display: none; }
}
@media (max-width: 420px) { .sep { margin: 0 0.3rem; } .top { font-size: 0.86rem; } }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 120px var(--gutter) clamp(18px, 2.6vw, 34px);
}
.hero-art { position: absolute; inset: 0; z-index: -1; background: var(--night); }
.hero-art img, .hero-art canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 62% 50%;
}
.hero-art canvas { opacity: 0; pointer-events: none; image-rendering: pixelated; }
.hero-art::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--night) 0%, rgb(21 20 42 / 0.55) 30%, rgb(21 20 42 / 0) 60%),
    linear-gradient(to right, rgb(21 20 42 / 0.55) 0%, rgb(21 20 42 / 0) 55%);
}
@media (prefers-reduced-motion: no-preference) {
  .js .hero-art:not(.resolved) img { opacity: 0; }
  .js.art-failsafe .hero-art img { opacity: 1; }
  .hero-art.resolving canvas { opacity: 1; }
  .hero-art.resolved canvas { opacity: 0; transition: opacity 0.3s; }
}

.hero-copy {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 24px 48px; margin-bottom: clamp(28px, 4vw, 56px);
}
.lede {
  max-width: 21ch;
  font-size: clamp(1.6rem, 1rem + 2.1vw, 2.9rem);
  font-weight: 600; line-height: 1.08; letter-spacing: -0.03em;
}
.sub { margin-top: 14px; color: var(--dim); max-width: 42ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.wordmark { position: relative; color: var(--haze); font-size: 1rem; }
.wm-svg { display: block; width: 100%; height: auto; }
.labs {
  position: absolute; right: 0; bottom: 100%; margin-bottom: 0.35em;
  font-size: clamp(0.95rem, 0.6rem + 1.1vw, 1.5rem); font-weight: 700; letter-spacing: -0.01em;
}
@media (prefers-reduced-motion: no-preference) {
  .wm-svg.build rect { animation: px-in 0.36s steps(3, end) both; }
}
@keyframes px-in {
  from { opacity: 0; transform: translateY(-1.4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Section heads ---------- */
.sec-head { display: flex; align-items: flex-start; gap: 14px; }
.sec-head h2 {
  font-size: clamp(3.6rem, 1.6rem + 8.6vw, 10.5rem);
  font-weight: 800; line-height: 0.84; letter-spacing: -0.055em;
}
.count { margin-top: 0.4em; color: var(--flame); font-weight: 600; white-space: nowrap; }

/* ---------- Products ---------- */
.products { padding: clamp(80px, 11vw, 160px) var(--gutter) clamp(72px, 9vw, 130px); }
.product {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(36px, 6vw, 96px); align-items: start;
  margin-top: clamp(40px, 6vw, 84px); padding-top: 28px; border-top: 2px solid var(--rule);
}
@media (max-width: 900px) { .product { grid-template-columns: 1fr; } }

.idx { color: var(--dim); font-weight: 600; font-variant-numeric: tabular-nums; }
.p-name {
  margin-top: 10px;
  font-stretch: 62%; font-weight: 800;
  font-size: clamp(3.4rem, 1.4rem + 7.4vw, 8.4rem);
  line-height: 0.98; letter-spacing: -0.015em;
}
.p-name span { white-space: nowrap; }
.live { display: flex; align-items: center; gap: 10px; margin-top: 22px; font-weight: 600; }
.p-desc { margin-top: 18px; max-width: 54ch; color: var(--dim); }
.facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px;
  margin: 30px 0 34px; max-width: 560px;
}
.facts div { padding: 12px 0; border-top: 2px solid var(--rule); }
.facts dt { color: var(--dim); font-size: 0.88rem; }
.facts dd { font-weight: 600; }

/* Character select */
.select { display: grid; gap: 18px; }
.card {
  --ry: -9deg; --rx: 3deg; --accent: #6FB7FF;
  position: relative; overflow: hidden; aspect-ratio: 5 / 4;
  background: var(--dusk);
  transform: perspective(1100px) rotateY(var(--ry)) rotateX(var(--rx));
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1);
  clip-path: polygon(14px 0, calc(100% - 14px) 0, calc(100% - 14px) 14px, 100% 14px, 100% calc(100% - 14px),
    calc(100% - 14px) calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 14px calc(100% - 14px), 0 calc(100% - 14px), 0 14px, 14px 14px);
}
.card[data-faction="bach-ho"] { --accent: #F1EDE3; }
.card[data-faction="chu-tuoc"] { --accent: #FF8A4D; }
.card[data-faction="huyen-vu"] { --accent: #BC9CFF; }
.card-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(1.1); }
.card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgb(21 20 42 / 0.85) 0%, rgb(21 20 42 / 0) 45%);
}
.card-hero {
  position: absolute; z-index: 1; left: 50%; bottom: -2%;
  height: 104%; width: auto; max-width: none; transform: translateX(-46%);
  filter: drop-shadow(0 18px 30px rgb(10 9 25 / 0.55));
}
.card-name {
  position: absolute; z-index: 2; left: 22px; bottom: 14px;
  font-stretch: 62%; font-weight: 800; font-size: clamp(2.2rem, 1.4rem + 2.6vw, 3.6rem);
  line-height: 1; color: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .card.swap .card-hero { animation: hero-swap 0.44s steps(6, end) both; }
  .card.swap .card-bg { animation: bg-swap 0.44s steps(4, end) both; }
}
@keyframes hero-swap {
  0% { clip-path: inset(0 0 0 0); }
  40% { clip-path: inset(100% 0 0 0); }
  41% { clip-path: inset(0 0 100% 0); }
  100% { clip-path: inset(0 0 0 0); }
}
@keyframes bg-swap { 0%, 100% { opacity: 1; } 40% { opacity: 0.25; } }

.tabs { display: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.js .tabs { display: grid; }
@media (max-width: 560px) { .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tabs button {
  --n: 5px;
  display: grid; gap: 2px; text-align: left;
  padding: 10px 12px; min-height: 56px;
  font: inherit; font-weight: 700; font-size: 0.98rem; line-height: 1.15;
  color: var(--text); background: var(--night-2); border: 0; cursor: pointer;
  clip-path: polygon(var(--n) 0, calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n),
    100% calc(100% - var(--n)), calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%,
    var(--n) 100%, var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n)), 0 var(--n), var(--n) var(--n));
}
.tabs small { font-weight: 500; font-size: 0.78rem; color: var(--dim); }
.tabs button:hover { background: var(--dusk); }
.tabs [aria-selected="true"] { background: var(--haze); color: var(--night); }
.tabs [aria-selected="true"] small { color: var(--haze-ink); }
.tabs button:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--flame); }

.panel > p:first-child { color: var(--text); max-width: 52ch; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); gap: 10px 28px; margin-top: 16px; }
.stats div { display: grid; grid-template-columns: 5.6rem 1fr; align-items: center; gap: 10px; }
.stats dt { color: var(--dim); font-size: 0.88rem; }
.stats dd { display: flex; align-items: center; gap: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Seven-segment pixel bar: --v lit segments out of 7. */
.bar {
  --seg: 13px;
  width: calc(var(--seg) * 7); height: 13px; flex: none;
  background:
    repeating-linear-gradient(90deg, var(--flame) 0 calc(var(--seg) - 3px), transparent 0 var(--seg)) 0 0 / calc(var(--seg) * var(--v)) 100% no-repeat,
    repeating-linear-gradient(90deg, rgb(231 229 240 / 0.14) 0 calc(var(--seg) - 3px), transparent 0 var(--seg));
}
@media (prefers-reduced-motion: no-preference) {
  .panel:not([hidden]) .bar { animation: bar-fill 0.5s steps(7, end); }
}
@keyframes bar-fill {
  from { background-size: 0 100%, 100% 100%; }
}
.hpmp { margin-top: 12px; color: var(--dim); font-size: 0.88rem; }

/* 52-day proof strip */
.proof {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px clamp(28px, 5vw, 72px); align-items: end;
  margin-top: clamp(80px, 11vw, 150px); padding-top: 30px; border-top: 2px solid var(--rule);
}
.proof-num { display: flex; align-items: flex-end; gap: 14px; color: var(--ember); }
.px52 { width: clamp(150px, 18vw, 270px); height: auto; display: block; }
.proof-num span { font-weight: 700; font-size: clamp(1.2rem, 0.9rem + 1vw, 1.8rem); color: var(--text); line-height: 1; }
.proof-big { font-size: clamp(1.4rem, 1rem + 1.4vw, 2.2rem); font-weight: 600; line-height: 1.15; letter-spacing: -0.025em; max-width: 26ch; }
.proof-copy p + p { margin-top: 12px; color: var(--dim); max-width: 58ch; }
.days {
  grid-column: 1 / -1;
  list-style: none; padding: 0; margin-top: 18px;
  display: grid; grid-template-columns: repeat(52, minmax(0, 1fr)); gap: 4px;
}
.days li { aspect-ratio: 1; background: var(--flame); }
.days li.launch { background: var(--ember); }
@media (max-width: 760px) { .days { grid-template-columns: repeat(26, minmax(0, 1fr)); gap: 3px; } }
.days-legend {
  grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 16px;
  color: var(--dim); font-size: 0.88rem;
}
.days-legend span:last-child { text-align: right; }
@media (max-width: 760px) { .proof { grid-template-columns: 1fr; } }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .days li:not(.launch) {
      animation: day-on linear both;
      animation-timeline: view();
      animation-range: cover calc(12% + var(--i) * 0.62%) cover calc(13% + var(--i) * 0.62%);
    }
  }
}
@keyframes day-on { from { background: rgb(231 229 240 / 0.12); } to { background: var(--flame); } }

/* ---------- Services ---------- */
.services {
  background: var(--haze); color: var(--night);
  padding: clamp(80px, 11vw, 160px) var(--gutter);
}
.services-head { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px clamp(32px, 6vw, 96px); align-items: end; }
@media (max-width: 900px) { .services-head { grid-template-columns: 1fr; } }
.services h2 {
  font-size: clamp(2.8rem, 1.3rem + 5.6vw, 7.2rem);
  font-weight: 800; line-height: 0.9; letter-spacing: -0.05em; max-width: 11ch;
}
.services-head p { color: var(--haze-ink); max-width: 50ch; font-size: 1.08rem; }

.offer { list-style: none; padding: 0; margin-top: clamp(48px, 7vw, 96px); border-top: 2px solid var(--night); }
.offer li { border-bottom: 2px solid var(--night); }
.offer a {
  display: grid; grid-template-columns: 48px minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px 28px; align-items: center;
  padding: 24px 16px; margin: 0 -16px;
  text-decoration: none; color: inherit;
  transition: background-color 0.12s steps(2), color 0.12s steps(2);
}
.ico { width: 40px; height: 40px; display: block; transition: color 0.12s steps(2); }
.o-name { font-size: clamp(1.45rem, 1rem + 1.7vw, 2.6rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; }
.o-desc { color: var(--haze-ink); }
.offer a:hover, .offer a:focus-visible { background: var(--night); color: var(--haze); outline: none; }
.offer a:hover .o-desc, .offer a:focus-visible .o-desc { color: var(--dim); }
.offer a:hover .ico, .offer a:focus-visible .ico { color: var(--ember); }
@media (max-width: 760px) {
  .offer a { grid-template-columns: 40px minmax(0, 1fr); }
  .ico { width: 32px; height: 32px; }
  .o-desc { grid-column: 2; }
}

.steps-title { margin-top: clamp(64px, 9vw, 120px); font-size: clamp(1.3rem, 1rem + 1vw, 1.8rem); font-weight: 700; letter-spacing: -0.02em; }
.steps { list-style: none; padding: 0; margin-top: 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }
.steps li { color: var(--haze-ink); }
.step-n { display: block; width: 25px; height: auto; color: var(--ember); margin-bottom: 18px; }
.steps strong { display: block; color: var(--night); font-weight: 700; margin-bottom: 4px; }

/* ---------- Contact ---------- */
.contact { background: var(--ember); color: var(--night); padding: clamp(84px, 12vw, 170px) var(--gutter); }
.contact h2 { font-size: clamp(2.9rem, 1.3rem + 6.4vw, 8.2rem); font-weight: 800; line-height: 0.9; letter-spacing: -0.055em; max-width: 12ch; }
.contact p { margin-top: 22px; max-width: 46ch; font-size: 1.08rem; color: #3B1A10; }
.mail {
  display: inline-block; margin-top: clamp(36px, 5vw, 64px);
  font-size: clamp(1.3rem, 0.5rem + 4.6vw, 4.8rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05;
  color: var(--night); text-decoration: underline; text-decoration-thickness: 0.07em; text-underline-offset: 0.14em;
  overflow-wrap: anywhere;
}
.mail:hover { text-decoration-color: var(--haze); }
.mail:focus-visible { outline-color: var(--night); }

/* ---------- Footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px;
  padding: 26px var(--gutter) 30px; color: var(--dim); font-size: 0.9rem;
}
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot .mark { height: 18px; }
.foot a { color: var(--dim); }
.foot a:hover { color: var(--text); }
