@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;700&display=swap');

:root {
  --ink: #0d0d0d;
  --ink-2: #120c19;
  --violet: #8000ff;
  --magenta: #ff00ff;
  --aqua: #00ffd5;
  --text: #e6e1f2;
  --dim: #b6acc9;
  --line: rgba(128, 0, 255, 0.34);
  --mono: ui-monospace, SFMono-Regular, "Courier New", monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--ink);
  background-image:
    radial-gradient(circle at 12% -6%, rgba(128, 0, 255, 0.24), transparent 55%),
    radial-gradient(circle at 92% 6%, rgba(255, 0, 255, 0.14), transparent 48%),
    linear-gradient(rgba(128, 0, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(128, 0, 255, 0.07) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Noto Sans Thai', system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.78;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 4px);
}

h1, h2, h3, h4 { font-weight: 700; line-height: 1.32; }

a { color: var(--aqua); }

img { max-width: 100%; height: auto; }

hr {
  border: 0;
  height: 1px;
  margin: 14px 0 20px;
  background: linear-gradient(90deg, var(--magenta), var(--violet) 42%, transparent);
}

:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}

/* ---------- 顶部导航 ---------- */
.hud {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px clamp(14px, 4vw, 40px);
  background: rgba(13, 13, 13, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 44px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(255, 0, 255, 0.6);
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 8px var(--magenta));
}

.menu { position: relative; flex: 0 0 auto; }

.menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 15px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--violet);
  background: rgba(128, 0, 255, 0.14);
  color: #f4ecff;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.16em;
  user-select: none;
}

.menu summary::-webkit-details-marker { display: none; }

.menu summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta);
}

.menu menu {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.menu a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 0, 255, 0.34);
  color: #ebdfff;
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.menu a:hover,
.menu a:focus-visible {
  background: rgba(255, 0, 255, 0.16);
  border-color: var(--magenta);
  box-shadow: 0 0 14px rgba(255, 0, 255, 0.45);
}

.cta-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  background: linear-gradient(100deg, var(--violet), var(--magenta));
  box-shadow: 0 0 18px rgba(255, 0, 255, 0.45);
  white-space: nowrap;
}

/* ---------- 二级锚点条 ---------- */
.subnav {
  position: sticky;
  top: 65px;
  z-index: 60;
  display: flex;
  gap: 8px;
  padding: 9px clamp(14px, 4vw, 40px);
  overflow-x: auto;
  background: rgba(13, 13, 13, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  scrollbar-width: none;
}

.subnav::-webkit-scrollbar { display: none; }

.subnav a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(128, 0, 255, 0.42);
  color: #d0bdf6;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
}

.subnav a:hover { border-color: var(--magenta); color: #ffffff; }

/* ---------- Hero ---------- */
main section { scroll-margin-top: 128px; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  min-height: 45vh;
  padding: clamp(24px, 5vw, 56px) clamp(14px, 4vw, 40px) clamp(22px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}

.hero-copy { min-width: 0; }

h1 {
  position: relative;
  margin: 0 0 14px;
  font-size: clamp(25px, 5.1vw, 44px);
  line-height: 1.24;
  color: #ffffff;
  letter-spacing: 0.01em;
  text-shadow: 0 0 18px rgba(255, 0, 255, 0.45), 0 0 44px rgba(128, 0, 255, 0.35);
}

h1::before,
h1::after {
  content: attr(data-t);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
}

h1::before {
  color: var(--magenta);
  clip-path: inset(0 0 56% 0);
  transform: translate(2px, -2px);
  animation: glitch 5s infinite alternate linear;
}

h1::after {
  color: var(--aqua);
  clip-path: inset(56% 0 0 0);
  transform: translate(-2px, 2px);
  animation: glitch 4s 0.3s infinite alternate linear;
}

@keyframes glitch {
  0%, 90%, 100% { transform: translate(2px, -2px); }
  93% { transform: translate(-4px, 1px) skewX(-3deg); }
  96% { transform: translate(3px, -1px); }
}

.h1-rule { max-width: 180px; margin: 0 0 14px; }

.lead {
  margin: 0;
  max-width: 56ch;
  font-size: 16px;
  line-height: 1.8;
  color: var(--dim);
}

.hero-visual {
  position: relative;
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 190px;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(150deg, rgba(128, 0, 255, 0.42), rgba(255, 0, 255, 0.2) 58%, #0d0d0d);
  border: 1px solid rgba(255, 0, 255, 0.42);
  box-shadow: inset 0 0 42px rgba(128, 0, 255, 0.4);
}

.hero-img {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.holo {
  grid-area: 1 / 1;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--violet), var(--magenta), var(--aqua), var(--violet));
  filter: blur(1.5px);
  opacity: 0.78;
  animation: spin 9s linear infinite;
}

@keyframes spin { to { transform: rotate(1turn); } }

.badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px 4px 24px;
  border-radius: 999px;
  background: rgba(9, 6, 14, 0.82);
  border: 1px solid rgba(0, 255, 213, 0.5);
  color: var(--aqua);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.badge::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 10px var(--aqua);
  animation: blink 1.8s ease-in-out infinite;
}

@keyframes blink { 50% { opacity: 0.15; } }

/* ---------- 版心 ---------- */
.shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 44px) clamp(14px, 4vw, 40px);
}

.toc {
  border-left: 2px solid var(--violet);
  padding: 2px 0 2px 16px;
}

.toc h2 {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.34em;
  color: var(--magenta);
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.6);
}

.toc hr { margin: 8px 0 14px; }

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc li { counter-increment: toc; }

.toc a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 40px;
  padding: 4px 0;
  color: #c9bce0;
  text-decoration: none;
  font-size: 15px;
  line-height: 1.45;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--violet);
  flex: 0 0 auto;
}

.toc a:hover { color: #ffffff; text-shadow: 0 0 9px var(--magenta); }

/* ---------- 正文 ---------- */
.prose {
  min-width: 0;
  max-width: 74ch;
}

.prose section { padding-bottom: 10px; scroll-margin-top: 128px; }

.prose section > :first-child { margin-top: 0; }

.prose h2 {
  position: relative;
  margin: 2em 0 10px;
  padding-left: 15px;
  font-size: clamp(20px, 2.9vw, 27px);
  color: #ffffff;
}

.prose h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  width: 5px;
  height: 1em;
  background: linear-gradient(var(--magenta), var(--violet));
  box-shadow: 0 0 12px var(--magenta);
}

.prose h2 + hr { margin-top: 0; }

.prose h3 {
  margin: 1.8em 0 8px;
  font-size: 19px;
  color: #f3ecff;
}

.prose p { margin: 0 0 1.05em; color: #d6cfe4; }

.prose a {
  color: var(--aqua);
  text-decoration: underline;
  text-decoration-color: rgba(0, 255, 213, 0.45);
  text-underline-offset: 3px;
}

.prose a:hover { text-decoration-color: var(--aqua); text-shadow: 0 0 9px rgba(0, 255, 213, 0.7); }

.prose ul,
.prose ol { margin: 0 0 1.15em; padding-left: 1.25em; }

.prose li { margin: 0.35em 0; }

.prose li::marker { color: var(--violet); }

.prose figure {
  margin: 1.4em 0;
  padding: 12px 14px;
  border-radius: 4px;
  background: rgba(128, 0, 255, 0.13);
  border-left: 3px solid var(--magenta);
}

.prose aside {
  margin: 1.4em 0;
  padding: 14px 16px;
  border-radius: 4px;
  background: var(--ink-2);
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 12px 16px;
  border-radius: 4px;
  background: rgba(255, 0, 255, 0.1);
  border-left: 3px solid var(--violet);
  color: #e8def7;
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.3em 0;
  font-size: 16px;
}

.prose th,
.prose td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(128, 0, 255, 0.28);
}

.prose th { background: rgba(128, 0, 255, 0.16); color: #ffffff; }

.prose img { border-radius: 4px; }

.prose code {
  font-family: var(--mono);
  font-size: 14px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 0, 255, 0.14);
  color: #ffd9ff;
}

/* ---------- 页脚 ---------- */
footer {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  background: linear-gradient(#0d0d0d, #130c1b);
}

.cta-block {
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 52px) clamp(14px, 4vw, 40px);
  text-align: center;
}

.big-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  max-width: 100%;
  padding: 8px 30px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: clamp(17px, 2.6vw, 22px);
  color: #ffffff;
  background: linear-gradient(100deg, var(--violet), var(--magenta));
  box-shadow: 0 0 26px rgba(255, 0, 255, 0.42);
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.5);
}

.foot-cols {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 40px) 26px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.foot-cols dl { margin: 0; }

.foot-cols dt {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--violet);
  margin-bottom: 6px;
}

.foot-cols dd { margin: 0; }

.foot-cols a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: #c3b6dc;
  text-decoration: none;
  font-size: 15px;
}

.foot-cols a:hover { color: #ffffff; text-shadow: 0 0 9px var(--magenta); }

.foot-base {
  border-top: 1px solid rgba(128, 0, 255, 0.22);
  padding: 14px clamp(14px, 4vw, 40px);
  text-align: center;
  font-size: 15px;
  color: #8d84a0;
}

/* ---------- 动效 ---------- */
.js .hero-visual,
.js .prose section {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.js .hero-visual.in,
.js .prose section.in { opacity: 1; transform: none; }

.js .toc li { opacity: 0; animation: fadein 0.45s ease forwards; }

@keyframes fadein { to { opacity: 1; } }

/* ---------- 断点 ---------- */
@media (max-width: 479px) {
  .brand { font-size: 14px; }
  .cta-pill { padding: 0 12px; font-size: 13px; }
  .menu summary { padding: 0 12px; letter-spacing: 0.1em; }
  .badge { font-size: 12px; }
}

@media (max-width: 879px) {
  .menu menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(80vw, 300px);
    flex-direction: column;
    padding: 10px;
    border-radius: 8px;
    background: #130c1b;
    border: 1px solid rgba(255, 0, 255, 0.5);
    box-shadow: 0 22px 46px rgba(0, 0, 0, 0.78);
  }
  .toc { position: static; }
}

@media (min-width: 720px) {
  .foot-cols { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 880px) {
  .hero {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    max-width: 1160px;
    margin: 0 auto;
  }
  .shell { grid-template-columns: 250px minmax(0, 1fr); gap: 34px; }
  .toc { position: sticky; top: 132px; align-self: start; }
}

@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;
  }
  .js .hero-visual,
  .js .prose section,
  .js .toc li { opacity: 1; transform: none; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
