/* Afterlife · 来生 — one stylesheet for the bar, its four rooms, and the articles. */

:root {
  --night: #0b0a1d;
  --night-2: #0f0c26;
  --panel: #0d0b22;
  --rule: #221b50;
  --edge: #2b2260;
  --edge-lit: #4a3b94;
  --ink: #efeaff;
  --ink-2: #b4add6;
  --ink-3: #8079ab;
  --pink: #ff4f9a;
  --cyan: #4fd8ff;
  --a: #ff4f9a;
  --a-rgb: 255, 79, 154;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", ui-monospace, Menlo, Consolas, "Courier New", monospace;
}

[data-drink="0"], [data-page="writing"]  { --a: #ffc24a; --a-rgb: 255, 194, 74; }
[data-drink="1"], [data-page="projects"] { --a: #4fd8ff; --a-rgb: 79, 216, 255; }
[data-drink="2"], [data-page="journal"]  { --a: #ff5fa2; --a-rgb: 255, 95, 162; }
[data-drink="3"], [data-page="about"]    { --a: #8ff0d0; --a-rgb: 143, 240, 208; }

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

html {
  background: var(--night);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--night);
  color: var(--ink);
  font: 16px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
::selection { background: rgba(var(--a-rgb), 0.35); color: #fff; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ───────── header (shared) ───────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 796px;
  min-height: 56px;
  margin: 0 auto;
  padding: 6px 18px;
}

.identity {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font: 500 14px/1 var(--mono);
  letter-spacing: 0.14em;
}
.identity .ti {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border: 1px solid var(--pink);
  color: var(--pink);
  font-size: 15px;
  box-shadow: 0 0 10px rgba(255, 79, 154, 0.35), inset 0 0 6px rgba(255, 79, 154, 0.2);
}
.identity-zh {
  color: var(--cyan);
  font: 600 13px/1 var(--sans);
  letter-spacing: 0.3em;
  text-shadow: 0 0 10px rgba(79, 216, 255, 0.55);
}
.identity:hover span:first-of-type { color: #fff; }

.article-back {
  color: var(--ink-3);
  font: 13px/1 var(--mono);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
  text-decoration: none;
  font-family: var(--sans);
  letter-spacing: 0.2em;
  transition: color 0.15s;
}
.article-back::before { content: "←"; margin-right: 0.6em; font-family: var(--mono); }
.article-back:hover { color: var(--a); }

a:focus-visible {
  outline: 1px dashed var(--a);
  outline-offset: 4px;
}

/* ───────── home: the bar ───────── */

/* the room is the whole viewport: no header, no footer, nothing to scroll */
body.home {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(#090818 0%, #1e1146 46%, #471e66 72%, #0f0b27 72%);
}

.scene {
  position: absolute;
  left: 0; top: 0;
  display: block;
  width: 100%; height: 100%;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  pointer-events: none;
}

.drinks {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.drink {
  position: relative;
  z-index: 1;
  display: block;
  min-height: 112px;
  color: var(--ink);
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.drinks.placed { position: static; display: block; }
.drinks.placed .drink { position: absolute; bottom: 0; min-height: 0; }

.drink-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--front, 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding-bottom: 6px;
}
.drink-label b {
  font: 600 18px/1.1 var(--sans);
  letter-spacing: 0.34em;
  margin-right: -0.34em;
  color: #ddd6f6;
  transition: color 0.18s, text-shadow 0.18s;
}
.drink-label small {
  font: 12px/1 var(--sans);
  letter-spacing: 0.4em;
  margin-right: -0.4em;
  color: var(--a);
  opacity: 0.72;
  transition: opacity 0.18s;
}
.drink-label::after {
  content: "";
  width: 14px; height: 2px;
  margin-top: 3px;
  background: var(--a);
  opacity: 0.35;
  transition: width 0.22s ease, opacity 0.22s, box-shadow 0.22s;
}
.drink:hover b, .drink.is-active b, .drink:focus-visible b {
  color: #fff;
  text-shadow: 0 0 14px rgba(var(--a-rgb), 0.9);
}
.drink:hover small, .drink.is-active small, .drink:focus-visible small { opacity: 1; }
.drink:hover .drink-label::after, .drink.is-active .drink-label::after, .drink:focus-visible .drink-label::after {
  width: 40px;
  opacity: 1;
  box-shadow: 0 0 10px var(--a);
}
/* picked: the neon under the name stretches with the lifting glass (canvas draws the glass itself) */
.drink.is-pouring .drink-label::after {
  width: 56px;
  opacity: 1;
  box-shadow: 0 0 6px var(--a), 0 0 16px var(--a);
  transition-duration: 0.16s;
}
.drink:focus-visible { outline: none; }
.drink:focus-visible .drink-label {
  outline: 1px dashed var(--a);
  outline-offset: -5px;
}

/* faint scanlines over the glass of the screen (lighter on the homepage so her face reads clean) */
.stage::after, .pour::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(6, 4, 18, 0.1) 2px 3px);
  pointer-events: none;
}
.stage::after {
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 3px, rgba(6, 4, 18, 0.04) 3px 4px);
}
.drinks.tight .drink-label b { font-size: 16px; letter-spacing: 0.22em; margin-right: -0.22em; }
.drinks.tight .drink-label small { font-size: 11px; letter-spacing: 0.3em; margin-right: -0.3em; }

/* ───────── the four rooms ───────── */

.page {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(var(--a-rgb), 0.09), transparent 60%),
    var(--night);
}

.sheet {
  flex: 1;
  width: 100%;
  max-width: 796px;
  margin: 0 auto;
  padding: 4px 18px 48px;
}

.pour {
  position: relative;
  height: 216px;
  overflow: hidden;
  border: 1px solid var(--edge);
  background: linear-gradient(#090818 0%, #291453 50%, #0f0b27 66%);
  box-shadow: 0 0 0 3px var(--night), 0 0 0 4px #17123a, 0 24px 50px -32px rgba(var(--a-rgb), 0.6);
}

.head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 34px 2px 20px;
  border-bottom: 1px dashed var(--edge);
}
.head h1 {
  margin: 0;
  font: 700 34px/1.2 var(--serif);
  letter-spacing: 0.12em;
}
.kicker {
  margin: 0;
  color: var(--a);
  font: 600 14px/1 var(--sans);
  letter-spacing: 0.4em;
  text-shadow: 0 0 12px rgba(var(--a-rgb), 0.55);
}
.kicker::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 12px;
  background: var(--a);
  box-shadow: 0 0 10px var(--a);
}

.content { min-height: 180px; }
.content > p { margin: 22px 2px; color: var(--ink-2); }
.content a { text-underline-offset: 4px; text-decoration-color: rgba(var(--a-rgb), 0.6); }

.list, .notes { list-style: none; margin: 0; padding: 0; }

.row {
  display: grid;
  grid-template-columns: 7em minmax(0, 1fr) auto;
  gap: 4px 20px;
  align-items: baseline;
  min-height: 64px;
  padding: 20px 6px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  transition: background 0.18s, padding 0.18s;
}
.row--plain { grid-template-columns: minmax(0, 1fr) auto; }
.row time, .note time {
  color: var(--ink-3);
  font: 13px/1.7 var(--mono);
  letter-spacing: 0.06em;
}
.row-title {
  font: 700 19px/1.5 var(--serif);
  letter-spacing: 0.06em;
  color: var(--ink);
  transition: color 0.18s;
}
.row-sub {
  grid-column: 2;
  color: var(--ink-2);
  font-size: 14px;
}
.row--plain .row-sub { grid-column: 1; }
.row .ti {
  grid-column: 3;
  grid-row: 1;
  color: var(--a);
  font-size: 18px;
  opacity: 0.6;
  transition: opacity 0.18s, transform 0.18s;
}
.row--plain .ti { grid-column: 2; }
a.row:hover, a.row:focus-visible {
  background: linear-gradient(90deg, rgba(var(--a-rgb), 0.09), transparent 70%);
  padding-left: 14px;
}
a.row:hover .row-title, a.row:focus-visible .row-title { color: var(--a); }
a.row:hover .ti, a.row:focus-visible .ti { opacity: 1; transform: translateX(3px); }
a.row:focus-visible { outline-offset: -3px; }

.note {
  display: grid;
  grid-template-columns: 7em minmax(0, 1fr);
  gap: 4px 20px;
  padding: 20px 6px;
  border-bottom: 1px solid var(--rule);
}
.note p {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.about-text {
  position: relative;
  margin: 40px 2px 20px;
  padding-left: 22px;
  font: 400 23px/1.9 var(--serif);
  letter-spacing: 0.08em;
  white-space: pre-line;
}
.about-text::before {
  content: "";
  position: absolute;
  left: 0; top: 0.55em; bottom: 0.55em;
  width: 2px;
  background: var(--a);
  box-shadow: 0 0 12px var(--a);
}
.about-sign {
  margin: 0 2px;
  padding-left: 22px;
  color: var(--ink-3);
  font: 13px/1.6 var(--mono);
  letter-spacing: 0.14em;
}

.empty {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 44px 6px 36px;
}
.empty canvas {
  flex: none;
  width: 96px; height: 132px;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}
.empty strong {
  display: block;
  font: 700 21px/1.5 var(--serif);
  letter-spacing: 0.1em;
}
.empty span {
  display: block;
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 796px;
  margin: 0 auto;
  padding: 0 18px 34px;
}
.rail a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 60px;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--ink-2);
  text-decoration: none;
  font: 600 15px/1 var(--sans);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  transition: border-color 0.18s, color 0.18s, box-shadow 0.18s;
}
.rail a small {
  color: var(--a);
  font-size: 11px;
  font-weight: 400;
  opacity: 0.75;
}
.rail a:hover, .rail a:focus-visible, .rail a[aria-current] {
  border-color: var(--a);
  color: #fff;
  box-shadow: 0 0 18px -6px var(--a), inset 0 -2px 0 var(--a);
}
.rail a:focus-visible { outline-offset: 3px; }

/* ───────── articles (/posts/*.html) ───────── */

main > article {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 20px 96px;
}
main > article > h1 {
  margin: 0 0 30px;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--edge);
  font: 700 32px/1.4 var(--serif);
  letter-spacing: 0.06em;
}
.article-content {
  font-size: 17px;
  line-height: 1.95;
  color: #ddd7f2;
  overflow-wrap: anywhere;
}
.article-content p { margin: 0 0 1.4em; }
.article-content h2, .article-content h3 {
  margin: 2.2em 0 0.8em;
  font-family: var(--serif);
  line-height: 1.5;
  color: var(--ink);
}
.article-content h2 { font-size: 23px; }
.article-content h3 { font-size: 19px; }
.article-content a { color: var(--cyan); text-underline-offset: 4px; }
.article-content blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--pink);
  color: var(--ink-2);
}
.article-content img, .article-content video { max-width: 100%; height: auto; }
.article-content hr { height: 1px; margin: 2.4em 0; border: 0; background: var(--edge); }
.article-content code {
  padding: 0.1em 0.4em;
  background: #15113a;
  font: 0.88em var(--mono);
}
.article-content pre {
  margin: 1.6em 0;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  background: var(--panel);
  line-height: 1.6;
}
.article-content pre code { padding: 0; background: none; }
.article-content ul, .article-content ol { padding-left: 1.4em; margin: 0 0 1.4em; }

/* ───────── small screens ───────── */

@media (max-width: 640px) {
  .site-header { padding-left: 14px; padding-right: 14px; }
  .sheet { padding: 2px 14px 36px; }
  .pour { height: 172px; }
  .head { flex-direction: column; gap: 14px; padding-top: 28px; }
  .head h1 { font-size: 29px; }
  .row { grid-template-columns: minmax(0, 1fr) auto; padding: 16px 4px; }
  .row time { grid-column: 1; grid-row: 1; }
  .row .row-title { grid-column: 1; }
  .row .row-sub { grid-column: 1; }
  .row .ti { grid-column: 2; grid-row: 2; }
  .row--plain .ti { grid-row: 1; }
  .note { grid-template-columns: 1fr; }
  .about-text { font-size: 20px; margin-top: 30px; }
  .empty { gap: 18px; padding: 32px 2px 28px; }
  .empty canvas { width: 64px; height: 88px; }
  .empty strong { font-size: 19px; }
  .rail { gap: 6px; padding: 0 14px 26px; }
  .rail a { font-size: 14px; letter-spacing: 0.2em; text-indent: 0.2em; }
  main > article > h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
