@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

:root {
  --magenta: #ff0080;
  --violet: #ff00ff;
  --ink: #26171f;
  --void: #12060f;
  --paper: #f8ecf5;
  --soft: #e6d3e2;
  --line: rgba(255, 0, 128, 0.28);
  --line-2: rgba(255, 0, 255, 0.22);
  --r: 4px;
  --head-w: 246px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding-left: var(--head-w);
  min-height: 100vh;
  font-family: 'Space Mono', ui-monospace, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace;
  font-size: 17px;
  line-height: 1.75;
  color: var(--paper);
  background:
    radial-gradient(58vw 48vw at 8% -6%, rgba(255, 0, 128, 0.55), transparent 62%),
    radial-gradient(52vw 42vw at 98% 8%, rgba(255, 0, 255, 0.42), transparent 66%),
    radial-gradient(70vw 60vw at 48% 104%, rgba(126, 0, 255, 0.45), transparent 70%),
    linear-gradient(158deg, #180812 0%, #26171f 46%, #12060f 100%);
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: screen;
  filter: blur(60px);
  background: conic-gradient(
    from 0deg at 68% 24%,
    rgba(255, 0, 128, 0.38),
    rgba(255, 0, 255, 0.28),
    rgba(0, 210, 255, 0.18),
    rgba(255, 0, 128, 0.38)
  );
  animation: aurora 24s linear infinite;
}

@keyframes aurora {
  0% { transform: rotate(0deg) scale(1.05); }
  50% { transform: rotate(0.5turn) scale(1.2); }
  100% { transform: rotate(1turn) scale(1.05); }
}

a { color: #ff5cb4; text-decoration: none; }
a:hover, a:focus-visible { color: #fff; }

img { max-width: 100%; }

.masthead,
main,
.footer { position: relative; z-index: 1; }

/* -------- masthead -------- */
.masthead {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--head-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(38, 23, 31, 0.97), rgba(18, 6, 15, 0.95));
  backdrop-filter: blur(10px);
}

.ticker {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 0, 128, 0.36), rgba(255, 0, 255, 0.18));
}

.ticker-track {
  display: flex;
  gap: 14px;
  width: max-content;
  padding: 7px 0;
  font-size: 16px;
  letter-spacing: 0.12em;
  white-space: nowrap;
  animation: slide 22s linear infinite;
}

.ticker-track span { opacity: 0.85; }
.ticker-track span:nth-child(even) { opacity: 0.45; }

@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.brandline {
  padding: 16px 16px 10px;
  border-bottom: 1px dashed var(--line-2);
}

.brand { margin: 0; }

.brand a {
  display: inline-block;
  padding: 8px 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: #fff;
  border-bottom: 3px solid transparent;
  background-image: linear-gradient(90deg, var(--magenta), var(--violet));
  background-size: 100% 3px;
  background-repeat: no-repeat;
  background-position: 0 100%;
}

.pnav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
}

.pnav-row,
.pnav-more-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.pnav-row a,
.pnav-more-row a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 11px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255, 0, 128, 0.09);
}

.pnav-row a:hover,
.pnav-more-row a:hover,
.pnav-row a:focus-visible,
.pnav-more-row a:focus-visible {
  color: #fff;
  border-color: var(--violet);
  background: rgba(255, 0, 255, 0.22);
}

.pnav-more { margin-top: 10px; }

.pnav-more summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 8px 11px;
  font-size: 16px;
  color: var(--soft);
  cursor: pointer;
  list-style: none;
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
}

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

.pnav-more summary::after {
  content: '+';
  color: var(--magenta);
}

.pnav-more[open] summary::after { content: '−'; }

.pnav-more-row { margin-top: 10px; }

.masthead-foot {
  margin: 0;
  padding: 12px 16px 18px;
  border-top: 1px solid var(--line-2);
}

.masthead-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 16px;
  color: var(--soft);
}

/* -------- hero -------- */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
  padding: 96px clamp(20px, 4vw, 58px) clamp(36px, 6vw, 68px);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 110% at 100% 0%, rgba(255, 0, 255, 0.5), transparent 62%),
    linear-gradient(150deg, #2c1024 0%, #150811 100%);
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, rgba(18, 6, 15, 0.96) 6%, rgba(18, 6, 15, 0.62) 48%, rgba(255, 0, 128, 0.2) 100%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 36ch;
  text-align: right;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4.6vw, 56px);
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(18, 6, 15, 0.85);
}

.hero-desc {
  margin: 0;
  font-size: 17px;
  line-height: 1.75;
  color: rgba(255, 236, 248, 0.88);
}

/* -------- main / entry -------- */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: clamp(20px, 3vw, 46px);
  padding-right: clamp(16px, 3vw, 40px);
}

section { min-width: 0; }

.entry {
  padding: 0 clamp(20px, 4vw, 58px) clamp(40px, 6vw, 72px);
  counter-reset: sec;
  max-width: 78ch;
}

.entry > div {
  padding: clamp(30px, 4.6vw, 56px) 0;
  border-bottom: 1px dashed var(--line-2);
  scroll-margin-top: 24px;
}

.entry > div:last-child { border-bottom: 0; }

.entry > div::before {
  counter-increment: sec;
  content: counter(sec, decimal-leading-zero);
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
  letter-spacing: 0.3em;
  color: rgba(255, 0, 128, 0.9);
}

.entry h2,
.entry h3 {
  margin: 0 0 14px;
  line-height: 1.35;
  color: #fff;
}

.entry h2 { font-size: clamp(22px, 2.7vw, 31px); }
.entry h3 { font-size: 20px; }

.entry h2 span,
.entry h3 span {
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
}

.entry h2 span::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--magenta), var(--violet));
}

.entry p {
  margin: 0 0 1em;
  color: var(--soft);
}

.entry ul,
.entry ol {
  margin: 0 0 1.1em;
  padding-left: 1.3em;
  color: var(--soft);
}

.entry li { margin: 0.35em 0; }

.entry li::marker { color: var(--magenta); }

.entry img {
  border-radius: var(--r);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.entry figure { margin: 0 0 1.2em; }

.entry blockquote {
  margin: 1.2em 0;
  padding: 6px 0 6px 18px;
  border-left: 3px solid var(--magenta);
  color: #ffd9ec;
}

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

.entry th,
.entry td {
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--line-2);
}

.entry th { background: rgba(255, 0, 128, 0.12); }

.entry code,
.entry pre {
  font-family: 'Space Mono', ui-monospace, monospace;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--r);
}

.entry code { padding: 1px 6px; font-size: 15px; }
.entry pre { padding: 14px; overflow-x: auto; }

/* -------- rail -------- */
.rail {
  position: sticky;
  top: 0;
  align-self: start;
  padding: 26px 0 40px;
}

.rail h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #fff;
}

.rail h2 span {
  display: inline-block;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--violet);
}

.rail-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
}

.rail-links a,
.rail-top {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 16px;
  color: var(--soft);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: rgba(38, 23, 31, 0.55);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.rail-links a:hover,
.rail-top:hover {
  color: #fff;
  border-color: var(--magenta);
  background: rgba(255, 0, 128, 0.18);
}

.rail-top { color: #fff; border-style: dashed; }

/* -------- footer -------- */
.footer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 26px;
  padding: clamp(40px, 6vw, 70px) clamp(20px, 4vw, 58px) 0;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 6, 15, 0), rgba(18, 6, 15, 0.75));
}

.footer div { min-width: 0; }

.foot-cta { grid-column: span 2; }

.footer h2 {
  margin: 0 0 12px;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.3;
  color: #fff;
}

.footer h2 span {
  display: inline-block;
  padding-bottom: 6px;
  background-image: linear-gradient(90deg, var(--magenta), var(--violet));
  background-size: 100% 3px;
  background-repeat: no-repeat;
  background-position: 0 100%;
}

.foot-top { margin: 0; }

.foot-top a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 18px;
  font-size: 16px;
  color: #fff;
  border: 1px solid var(--magenta);
  border-radius: var(--r);
  background: rgba(255, 0, 128, 0.16);
}

.foot-top a:hover { background: rgba(255, 0, 128, 0.34); }

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 16px;
  color: var(--soft);
}

.foot-note {
  margin: 0;
  font-size: 16px;
  color: rgba(230, 211, 226, 0.82);
}

.foot-bar {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 16px 0 22px;
  border-top: 1px solid var(--line-2);
}

.foot-bar p {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: rgba(230, 211, 226, 0.7);
}

/* -------- reveal -------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* -------- responsive -------- */
@media (max-width: 1020px) {
  :root { --head-w: 214px; }
}

@media (max-width: 900px) {
  body { padding-left: 0; }

  .masthead {
    position: static;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pnav { overflow: visible; padding: 12px 16px; flex: 0 0 auto; }
  .masthead-foot { display: none; }

  main {
    grid-template-columns: minmax(0, 1fr);
    padding-right: 0;
  }

  .rail {
    position: static;
    order: 2;
    padding: 8px clamp(20px, 5vw, 40px) 40px;
  }

  .hero {
    min-height: 0;
    padding: 46px 20px 40px;
  }

  .entry { padding: 0 20px 40px; }
  .entry > div { scroll-margin-top: 20px; }

  .footer { grid-template-columns: minmax(0, 1fr); }
  .foot-cta { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { animation: none; }
  .ticker-track { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

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