/* ==========================================================================
   ComicLab — comiclab.io.vn
   Single stylesheet, no external dependencies
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #08080f;
  --bg-alt: #0d0d18;
  --surface: #12121f;
  --surface-2: #171728;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --text: #f4f4f8;
  --muted: #a2a2b8;
  --muted-dim: #7c7c94;

  --accent: #ff3d71;
  --accent-2: #7c5cff;
  --accent-3: #22d3ee;
  --accent-4: #ffb020;

  --grad: linear-gradient(100deg, #ff3d71 0%, #ff6b3d 45%, #7c5cff 100%);
  --grad-soft: linear-gradient(140deg, rgba(255, 61, 113, 0.16), rgba(124, 92, 255, 0.16));

  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;

  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 18px 45px -18px rgba(255, 61, 113, 0.55);

  --maxw: 1180px;
  --header-h: 68px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.55rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.35rem); }
h3 { font-size: 1.09rem; }
p { margin: 0 0 1rem; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent-3);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 22px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(8, 8, 15, 0.72);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(8, 8, 15, 0.9);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--shadow-glow);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-accent {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav > a:not(.btn) {
  padding: 8px 13px;
  border-radius: 9px;
  font-size: 0.925rem;
  color: var(--muted);
  transition: color 0.18s ease, background 0.18s ease;
}
.nav > a:not(.btn):hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.nav > a.btn { margin-left: 10px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 38px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease,
    background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { box-shadow: 0 22px 55px -16px rgba(255, 61, 113, 0.7); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm { padding: 9px 17px; font-size: 0.875rem; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(56px, 9vw, 108px) 0 clamp(64px, 9vw, 116px);
  overflow: hidden;
  isolation: isolate;
}
.hero-glow {
  position: absolute;
  inset: -25% -10% auto -10%;
  height: 620px;
  z-index: -1;
  background:
    radial-gradient(48% 55% at 22% 30%, rgba(255, 61, 113, 0.22), transparent 68%),
    radial-gradient(45% 50% at 78% 18%, rgba(124, 92, 255, 0.22), transparent 70%),
    radial-gradient(38% 45% at 55% 65%, rgba(34, 211, 238, 0.11), transparent 70%);
  filter: blur(14px);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 72%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 72%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: clamp(32px, 5vw, 68px);
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 15px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.812rem;
  font-weight: 600;
  color: #d9d9e8;
  margin-bottom: 22px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-4);
  box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.65);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.6); }
  70%  { box-shadow: 0 0 0 9px rgba(255, 176, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 176, 32, 0); }
}

.hero h1 { margin-bottom: 20px; }
.grad {
  display: block;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  color: var(--muted);
  max-width: 56ch;
  margin-bottom: 30px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  margin-bottom: 40px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 34px;
  margin: 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.hero-stats div { min-width: 108px; }
.hero-stats dt {
  font-size: 0.735rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted-dim);
  font-weight: 700;
}
.hero-stats dd {
  margin: 3px 0 0;
  font-weight: 650;
  font-size: 0.95rem;
}

/* ---------- Hero visual (CSS comic board) ---------- */
.hero-visual { position: relative; }
.panel-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(2, 118px);
  gap: 13px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transform: rotate(-1.4deg);
}
.panel {
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  background: linear-gradient(150deg, #1b1b2e, #12121f);
}
.p1 { background: linear-gradient(150deg, rgba(255, 61, 113, 0.5), rgba(255, 107, 61, 0.16) 62%, #12121f); }
.p2 { background: linear-gradient(150deg, rgba(124, 92, 255, 0.5), rgba(34, 211, 238, 0.13) 65%, #12121f); }
.p3 { background: linear-gradient(150deg, rgba(34, 211, 238, 0.42), #12121f 70%); }
.p4 { background: linear-gradient(150deg, rgba(255, 176, 32, 0.4), #12121f 68%); }

.spark {
  position: absolute;
  inset: 26% auto auto 24%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, rgba(255, 255, 255, 0.05) 62%, transparent 72%);
  animation: float 5.5s ease-in-out infinite;
}
.bubble {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 16px;
  padding: 8px 11px;
  border-radius: 12px 12px 12px 3px;
  background: rgba(255, 255, 255, 0.94);
  color: #14141f;
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1.35;
}
.caption {
  position: absolute;
  inset: auto 10px 10px 10px;
  padding: 6px 9px;
  border-left: 3px solid var(--accent-4);
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.67rem;
  font-weight: 600;
  color: #f0f0f6;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-11px); }
}

.float-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 15px;
  border-radius: 13px;
  background: rgba(18, 18, 31, 0.93);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(9px);
  font-size: 0.8rem;
}
.float-card strong { font-size: 0.86rem; }
.float-card span { color: var(--muted); font-size: 0.745rem; }
.fc-1 { top: -18px; left: -22px; animation: float 6.5s ease-in-out infinite; }
.fc-2 { bottom: -20px; right: -16px; animation: float 7.5s ease-in-out infinite 0.8s; }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 8vw, 104px) 0; }
.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--line);
}
.section-head { max-width: 720px; margin-bottom: 48px; }
.eyebrow {
  font-size: 0.755rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 12px;
}
.section-sub { color: var(--muted); font-size: 1.03rem; margin-bottom: 0; }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(288px, 100%), 1fr));
  gap: 20px;
}
.card {
  position: relative;
  padding: 27px 25px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.24s ease, border-color 0.24s ease, background 0.24s ease;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--grad);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.card:hover::before { opacity: 1; }

.card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 17px;
  border-radius: 12px;
  color: #fff;
  background: var(--grad-soft);
  border: 1px solid var(--line-strong);
}
.card-icon svg { width: 22px; height: 22px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 0.945rem; margin-bottom: 0; }
.card-note {
  margin-top: 10px !important;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 0.865rem !important;
  color: var(--muted-dim) !important;
}
.card-cta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--grad-soft);
  border-color: rgba(255, 61, 113, 0.3);
}
.link-arrow {
  margin-top: auto;
  padding-top: 16px;
  font-weight: 650;
  color: var(--accent);
  transition: gap 0.2s ease;
}
.link-arrow:hover { text-decoration: underline; }
.link-arrow span { display: inline-block; transition: transform 0.2s ease; }
.link-arrow:hover span { transform: translateX(4px); }

/* ---------- Steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 20px;
  counter-reset: step;
}
.steps li {
  position: relative;
  padding: 26px 23px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.step-num {
  display: block;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-3);
  margin-bottom: 13px;
}
.steps h3 { margin-bottom: 7px; }
.steps p { color: var(--muted); font-size: 0.92rem; margin-bottom: 0; }

/* ---------- Stack ---------- */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 18px;
}
.stack-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 23px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  transition: border-left-color 0.24s ease, background 0.24s ease;
}
.stack-item:hover {
  background: var(--surface-2);
  border-left-color: var(--accent);
}
.stack-label {
  font-size: 0.735rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-dim);
}
.stack-value { font-weight: 700; font-size: 1.03rem; }
.stack-meta { color: var(--muted); font-size: 0.88rem; }

/* ---------- Timeline ---------- */
.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
  gap: 20px;
}
.timeline li {
  position: relative;
  padding: 26px 24px 26px 27px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 22px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--line-strong);
}
.timeline li.is-current {
  border-color: rgba(255, 61, 113, 0.42);
  background: linear-gradient(160deg, rgba(255, 61, 113, 0.1), var(--surface) 62%);
}
.timeline li.is-current::before { background: var(--grad); }
.phase {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.755rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-dim);
  margin-bottom: 12px;
}
.phase em {
  padding: 2px 9px;
  border-radius: 999px;
  font-style: normal;
  font-size: 0.665rem;
  background: var(--accent);
  color: #fff;
  letter-spacing: 0.08em;
}
.timeline h3 { margin-bottom: 7px; }
.timeline p { color: var(--muted); font-size: 0.92rem; margin-bottom: 0; }

/* ---------- CTA panel ---------- */
.cta-panel {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  padding: clamp(30px, 4.4vw, 52px);
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, rgba(255, 61, 113, 0.13), rgba(124, 92, 255, 0.13)), var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.cta-copy h2 { margin-bottom: 14px; }
.cta-copy > p { color: var(--muted); max-width: 52ch; }
.contact-list { margin-top: 26px; display: grid; gap: 11px; }
.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}
.contact-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.contact-list span {
  min-width: 138px;
  font-size: 0.735rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted-dim);
}
.contact-list strong { font-weight: 650; }
.contact-list a { color: var(--accent-3); }
.contact-list a:hover { text-decoration: underline; }
.cta-actions { display: grid; gap: 13px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  padding: 52px 0 28px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 30px;
}
.footer-brand { max-width: 360px; }
.footer-brand .brand-text { font-size: 1.16rem; font-weight: 800; letter-spacing: -0.03em; }
.footer-brand p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: flex-start;
}
.footer-nav a {
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.18s ease;
}
.footer-nav a:hover { color: var(--text); }
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.footer-bottom p {
  margin: 0;
  color: var(--muted-dim);
  font-size: 0.85rem;
}

/* ---------- Reveal on scroll ----------
   The hidden state is scoped to html.js so content stays visible when
   JavaScript is unavailable or the script fails to load. */
html.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.62s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { max-width: 540px; margin-inline: auto; width: 100%; }
  .fc-1 { left: -8px; }
  .fc-2 { right: -6px; }
  .cta-panel { grid-template-columns: 1fr; }
  .cta-actions { max-width: 380px; }
}

@media (max-width: 760px) {
  :root { --header-h: 62px; }
  body { font-size: 16px; }

  .nav-toggle { display: flex; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 14px 20px 22px;
    background: rgba(9, 9, 17, 0.985);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  .nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .nav > a:not(.btn) { padding: 13px 12px; font-size: 1rem; }
  .nav > a.btn { margin: 10px 0 0; }

  .panel-board { grid-template-rows: repeat(2, 96px); }
  .hero-stats { gap: 14px 26px; }
  .hero-stats div { min-width: 92px; }
  .cta-actions { max-width: none; }
}

@media (max-width: 420px) {
  .float-card { display: none; }
  .hero-actions .btn { width: 100%; }
}

/* ---------- Motion / contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #c9c9dd;
    --muted-dim: #adadc4;
    --line: rgba(255, 255, 255, 0.24);
    --line-strong: rgba(255, 255, 255, 0.4);
  }
}

@media print {
  .site-header, .hero-visual, .cta-actions, .nav-toggle { display: none; }
  body { background: #fff; color: #000; }
  .card, .steps li, .stack-item, .timeline li, .cta-panel { border-color: #ccc; background: #fff; }
  /* never let the scroll animation hide content on paper */
  html.js .reveal { opacity: 1 !important; transform: none !important; }
}
