/* hooded. flexoki-dark, a monospace stack, tiny type, one accent: the yellow of the wallpaper. */
:root {
  --background: #100F0F; --background-2: #1C1B1A; --surface: #282726; --surface-2: #343331;
  --foreground: #CECDC3; --muted-foreground: #878580; --faint: #575653; --accent: #D0A215; --accent-foreground: #100F0F;
  --border: #1F1D1C; --radius: 2px; --blue: #4385BE;
  --font-mono: 'JetBrains Mono', 'Berkeley Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  --font-zh: 'JetBrains Mono', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html { background: var(--background); color-scheme: dark; }
body { margin: 0; background: var(--background); color: var(--foreground); font-family: var(--font-mono); font-size: 11px; line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh; }
html[lang="zh"] body { font-family: var(--font-zh); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
pre { margin: 0; }
::selection { background: var(--accent); color: var(--accent-foreground); }

/* the wallpaper: a faint repeating pattern that reads as damp yellow paper if you look for it */
.wallpaper { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .035;
  background-image: repeating-linear-gradient(0deg, transparent 0 22px, var(--accent) 22px 23px), repeating-linear-gradient(90deg, transparent 0 22px, var(--accent) 22px 23px);
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%); }

.page { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 32px 24px; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; margin-bottom: 24px; }
.nav { display: flex; align-items: center; gap: 12px; }
.nav .tilde { color: var(--foreground); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.nav a { font-size: 10px; color: var(--faint); }
.nav a:hover, .nav a.active { color: var(--accent); }
.nav a.ext { margin-left: 4px; }
.pulse { display: flex; align-items: center; font-size: 10px; color: var(--faint); letter-spacing: .15em; }
.block-pulse { animation: 2.4s ease-in-out infinite block-pulse; display: inline-block; }
@keyframes block-pulse { 0%, 100% { opacity: .3 } 50% { opacity: 1 } }
.pulse.on .block-pulse { color: var(--accent); animation-duration: .9s; }
.lang { margin-left: 14px; letter-spacing: .05em; color: var(--faint); font-size: 10px; }
.lang:hover { color: var(--accent); }

.label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 0 0 12px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.label-row .label { margin: 0; }
.count { font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-foreground); }
.faint { color: var(--faint); }
.accent { color: var(--accent); }
.prose p { color: var(--muted-foreground); font-size: 11px; line-height: 1.75; margin: 0 0 12px; }
.prose a { color: var(--accent); }
.prose a:hover { text-decoration: underline; text-underline-offset: 2px; }
section { margin-bottom: 32px; }

/* hero */
.hero-hood { display: flex; justify-content: center; margin-bottom: 16px; }
.hero-hood img { width: 120px; height: 120px; opacity: .7; }
.ascii-logo { display: flex; justify-content: center; width: 100%; max-width: 92%; margin: 0 auto 24px; overflow: hidden; }
.ascii-logo pre { font-family: var(--font-mono); font-size: clamp(3px, .95vw, 6px); line-height: 1; color: var(--foreground); text-align: center; max-width: 100%; overflow: hidden; }

/* diagram */
.diagram { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 24px 0 8px; }
.diagram svg { max-width: 100%; height: auto; }
.diagram figcaption { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }

/* posts list */
.posts-head, .post-row { display: grid; grid-template-columns: 60px 1fr 36px; align-items: baseline; column-gap: 12px; padding: 6px 8px; font-size: 11px; }
@media (min-width: 640px) { .posts-head, .post-row { grid-template-columns: 60px 1fr minmax(0, 160px) 36px; } .sm-only { display: inline !important; } }
.sm-only { display: none; }
.posts-head { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding-bottom: 6px; margin-bottom: 2px; border-bottom: 1px solid var(--border); }
.posts-head .right, .post-row .right { text-align: right; }
.posts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.post-row { margin: 0 -8px; border-radius: var(--radius); transition: background-color .16s var(--ease-out); animation: stagger-rise .32s var(--ease-out) backwards; }
.post-row:hover { background: var(--background-2); }
.post-row .date { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 10px; }
.post-row .title { color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .16s; }
html[lang="zh"] .post-row .title { text-transform: none; letter-spacing: .04em; }
.post-row:hover .title { color: var(--foreground); }
.post-row .tags { color: var(--faint); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-row .read { color: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.post-row:hover .read { color: var(--muted-foreground); }
@keyframes stagger-rise { 0% { opacity: 0; transform: translateY(3px) } 100% { opacity: 1; transform: translateY(0) } }

/* live trace */
.live { border: 1px solid var(--border); border-radius: var(--radius); background: var(--background-2); padding: 12px 14px; }
.live-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.live-head .status { color: var(--muted-foreground); text-transform: none; letter-spacing: 0; }
.live-head .status.on { color: var(--accent); }
.trace { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; font-size: 10px; line-height: 1.6; scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }
.trace.tall { max-height: 70vh; }
.trace li { display: grid; grid-template-columns: 52px 78px 1fr; column-gap: 10px; color: var(--muted-foreground); animation: stagger-rise .28s var(--ease-out) backwards; }
.trace .t { color: var(--faint); font-variant-numeric: tabular-nums; }
.trace .k { color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.trace li.step .k, .trace li.published .k { color: var(--accent); }
.trace li.error .k, .trace li.error { color: #D14D41; }
.trace li.resonance .k { color: var(--blue); }
.trace li.published a { color: var(--accent); }
.trace .detail { color: var(--faint); display: block; white-space: pre-wrap; }
.stream { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; font-size: 10px; color: var(--muted-foreground); white-space: pre-wrap; max-height: 160px; overflow: hidden; display: none; line-height: 1.6; }
.stream.on { display: block; }
.stream .think { color: var(--faint); font-style: italic; }
.caret { display: inline-block; width: 6px; height: 10px; background: var(--accent); vertical-align: -1px; animation: caret-blink 1.1s steps(1) infinite; margin-left: 2px; }
@keyframes caret-blink { 50% { opacity: 0 } }
.live-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 10px; color: var(--faint); margin-top: 10px; }
.live-meta b { color: var(--muted-foreground); font-weight: 400; }

/* post page */
.reading-progress-track { position: fixed; top: 0; left: 0; right: 0; height: 1px; background: transparent; z-index: 30; }
.reading-progress-fill { height: 100%; width: 0; background: var(--accent); opacity: .7; transition: width .12s linear; }
.sticky-header { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: color-mix(in srgb, var(--background) 88%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); transform: translateY(-100%); transition: transform .28s var(--ease-out); }
.sticky-header[data-visible="true"] { transform: translateY(0); }
.sticky-header-inner { max-width: 720px; margin: 0 auto; padding: 8px 24px; display: flex; align-items: center; gap: 10px; font-size: 10px; }
.sticky-header-brand { display: flex; align-items: center; gap: 6px; color: var(--foreground); }
.sticky-header-logo { width: 16px; height: 16px; opacity: .7; }
.sticky-header-title { flex: 1; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sticky-header-mode { color: var(--faint); }
.post-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 24px; font-size: 11px; color: var(--muted-foreground); gap: 12px; }
.post-header .crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.post-header .crumbs .brand { display: flex; align-items: center; gap: 8px; color: var(--foreground); }
.post-header .crumbs .brand img { width: 30px; height: 30px; opacity: .7; }
.post-header .crumbs .slug { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-header .mode { font-size: 10px; color: var(--faint); white-space: nowrap; }
.essay-bug-frame { display: flex; justify-content: center; align-items: center; padding: 8px 0 14px; animation: hero-rise .6s var(--ease-out) backwards; }
@keyframes hero-rise { 0% { opacity: 0; transform: translateY(6px) } 100% { opacity: 1; transform: translateY(0) } }
.essay-bug { font-family: var(--font-mono); font-size: clamp(7px, 1.4vw, 11px); line-height: 1; white-space: pre; text-align: left; user-select: none; letter-spacing: 0; font-feature-settings: "liga" 0; filter: drop-shadow(0 0 8px rgba(208, 162, 21, .12)); animation: 7.2s ease-in-out infinite essay-bug-breathe; }
.essay-bug span[style*="color:rgb"] { text-shadow: 0 0 1.5px currentColor, 0 0 6px color-mix(in srgb, currentColor 35%, transparent); }
@keyframes essay-bug-breathe { 0%, 100% { opacity: .88; filter: drop-shadow(0 0 6px rgba(208, 162, 21, .08)) } 50% { opacity: 1; filter: drop-shadow(0 0 12px rgba(208, 162, 21, .22)) } }
.essay-bug-row { display: inline; animation: 9s ease-in-out infinite essay-bug-row-shift; }
.essay-bug-row:nth-child(3n+2) { animation-delay: .6s } .essay-bug-row:nth-child(3n+3) { animation-delay: 1.2s }
@keyframes essay-bug-row-shift { 50% { filter: brightness(1.08) } }
.post-meta { display: flex; align-items: baseline; gap: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 8px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.post-title { font-size: 11px; font-weight: 400; color: var(--foreground); margin: 0 0 12px; }
html[lang="zh"] .post-title { font-size: 13px; letter-spacing: .06em; }
.banner { overflow: hidden; margin: 0 0 12px; }
.banner pre { font-family: var(--font-mono); font-size: clamp(5px, 1.05vw, 9px); line-height: 1.05; color: var(--muted-foreground); white-space: pre; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.tag { font-size: 10px; color: var(--faint); border: 1px solid var(--border); border-radius: var(--radius); padding: 1px 6px; }
.tag.mode { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.post-body { color: var(--muted-foreground); font-size: 11px; line-height: 1.75; }
html[lang="zh"] .post-body { font-size: 12px; line-height: 1.95; letter-spacing: .02em; }
.post-body p { margin: 0 0 14px; }
.post-body p:last-child { margin-bottom: 0; }
.post-body strong { color: var(--foreground); font-weight: 500; }
.post-body em { font-style: italic; }
.post-body a { color: var(--accent); }
.post-body a:hover { text-decoration: underline; text-underline-offset: 2px; }
.post-body code { background: var(--background-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--foreground); padding: 1px 4px; font-size: 10px; }
.post-body blockquote { border-left: 2px solid var(--border); color: var(--faint); margin: 16px 0; padding-left: 12px; }
.post-body h2, .post-body h3, .post-body h4 { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 400; margin: 20px 0 8px; }
.post-body ul, .post-body ol { margin: 12px 0; padding-left: 20px; }
.section-break { text-align: center; color: var(--faint); letter-spacing: .5em; user-select: none; margin: 24px 0; font-size: 10px; }
.notice { font-size: 10px; color: var(--faint); border: 1px dashed var(--border); padding: 6px 8px; margin-bottom: 16px; }
.post-footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); }
.materials { list-style: none; margin: 0 0 16px; padding: 0; }
.materials li { display: grid; grid-template-columns: 76px 1fr 40px; gap: 10px; font-size: 10px; color: var(--muted-foreground); padding: 3px 0; }
.materials .layer { color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.materials .year { color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.materials a:hover { color: var(--accent); }
.reso { font-size: 10px; color: var(--faint); margin-bottom: 16px; }
.reso b { color: var(--muted-foreground); font-weight: 400; }
.foot-nav { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); padding-top: 16px; border-top: 1px solid var(--border); }
.foot-nav a:hover { color: var(--accent); }
.dots { text-align: center; color: var(--faint); font-size: 10px; letter-spacing: .5em; margin: 24px 0; }

/* about */
.about-nav { display: flex; gap: 12px; font-size: 10px; color: var(--faint); margin-bottom: 24px; flex-wrap: wrap; }
.about-nav a { color: var(--faint); }
.about-nav a:hover { color: var(--accent); }
.about-section { margin-bottom: 40px; }
.about-section .num { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.about-section h2 { font-size: 11px; font-weight: 500; color: var(--foreground); margin: 0 0 12px; }
.layer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
@media (min-width: 640px) { .layer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.layer-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--background-2); transition: transform .2s var(--ease-out), border-color .2s; }
.layer-card:hover { transform: translateY(-1px); border-color: var(--surface-2); }
.layer-card .k { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.layer-card .n { font-size: 16px; color: var(--foreground); font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.layer-card .d { font-size: 10px; color: var(--muted-foreground); }
.steps { list-style: none; margin: 12px 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; font-size: 10px; color: var(--muted-foreground); padding: 4px 0; border-bottom: 1px solid var(--border); }
.steps li span:first-child { color: var(--faint); font-variant-numeric: tabular-nums; }
.balancer { border: 1px solid var(--border); border-radius: var(--radius); background: var(--background-2); padding: 12px 14px; margin: 16px 0; }
.balancer .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 10px; color: var(--muted-foreground); padding: 4px 0; }
.balancer .row.next { color: var(--accent); }
.balancer .bar { flex: 1; height: 4px; background: var(--surface); border-radius: 2px; overflow: hidden; margin: 0 10px; }
.balancer .bar i { display: block; height: 100%; background: var(--faint); transition: width .3s var(--ease-out); }
.balancer .row.next .bar i { background: var(--accent); }
.balancer .btns { display: flex; gap: 10px; margin-top: 10px; }
.tile { font-size: 10px; color: var(--muted-foreground); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px 8px; transition: color .16s, border-color .16s, transform .12s; }
.tile:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tile:active { transform: scale(.97); }
.pairs { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 12px 0; }
@media (min-width: 640px) { .pairs { grid-template-columns: 1fr 1fr; } }
.pair { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; font-size: 10px; color: var(--muted-foreground); background: var(--background-2); }
.pair .from { color: var(--faint); }
.pair .to { color: var(--foreground); }

/* corpus */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 10px; color: var(--muted-foreground); }
.doc-list .y { color: var(--faint); font-variant-numeric: tabular-nums; }
.doc-list .tg { color: var(--faint); display: block; }
.doc-list a:hover { color: var(--accent); }

.site-footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); }

/* noclip transition: a short fall through the wall on navigation */
.noclip-in { animation: noclip .42s var(--ease-out) both; }
@keyframes noclip { 0% { opacity: 0; transform: translateY(6px); clip-path: inset(0 0 100% 0) } 40% { opacity: 1; clip-path: inset(0 0 30% 0) } 100% { opacity: 1; transform: none; clip-path: inset(0) } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
