@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Press+Start+2P&display=swap");

* {
  box-sizing: border-box;
}

:root {
  --bg: #121314;
  --bg-grid: rgba(255, 255, 255, 0.03);
  --panel: #1b1d1f;
  --panel-soft: #26292b;
  --text: #e7e7e7;
  --muted: #a2a2a2;
  --border: #44484c;
  --border-strong: #5a5f64;
  --shadow: #080b0d;
  --accent: #9fef00;
  --accent-strong: #cfff67;
  --accent-dark: #2f4b0a;
  --warn: #bce86a;
  --link: #9fef00;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-ui: "Press Start 2P", "IBM Plex Mono", monospace;
}

::selection {
  background: rgba(159, 239, 0, 0.25);
  color: #f7fce7;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font: 400 16px/1.65 var(--font-body);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 4px 4px, 4px 4px;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: #d6ff7a;
  text-decoration-color: var(--accent-strong);
}

.site-title,
.page-link-site,
.post-link,
.note-card h3 a,
.note-list a,
.post-meta a,
.note-post .post-meta a {
  text-decoration: none;
}

.wrapper {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  position: sticky;
  top: 8px;
  z-index: 1000;
  padding-top: 12px;
}

.header-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "title nav"
    "tagline nav";
  gap: 8px 16px;
  align-items: center;
  padding: 12px 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 2px #0f0f0f, 4px 4px 0 var(--shadow);
}

.site-title {
  grid-area: title;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.45;
  text-decoration: none;
}

.site-title:hover {
  color: var(--accent-strong);
}

.site-tagline {
  grid-area: tagline;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-nav {
  grid-area: nav;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-link-site {
  position: relative;
  display: inline-block;
  padding: 6px 10px 6px 1.4em;
  border: 2px solid var(--border);
  color: #e4e4e4;
  background: var(--panel-soft);
  box-shadow: 2px 2px 0 var(--shadow);
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 100ms ease;
}

.page-link-site::before {
  content: "▶";
  position: absolute;
  left: 0.38em;
  top: 50%;
  transform: translateY(-54%);
  font-size: 0.62em;
  color: var(--accent);
  opacity: 0;
  transition: opacity 100ms ease;
}

.page-link-site:hover,
.page-link-site.active {
  color: #11130b;
  background: var(--accent);
  border-color: #b7f24c;
  transform: translate(-1px, -1px);
}

.page-link-site:hover::before,
.page-link-site.active::before {
  opacity: 1;
}

.page-content {
  padding: 16px 0 44px;
}

.content-shell {
  margin-top: 14px;
  padding: 20px 22px 28px;
  border: 2px solid var(--border-strong);
  border-left-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 2px #0f0f0f, 6px 6px 0 var(--shadow);
}

.page-title,
.post-list-heading {
  margin: 0 0 14px;
  color: #f2f2f2;
  font-family: var(--font-body);
  font-size: clamp(1.12rem, 2.3vw, 1.32rem);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.01em;
  text-transform: none;
}

.post-title {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-family: var(--font-ui);
  font-size: clamp(1rem, 2.3vw, 1.2rem);
  line-height: 1.45;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-intro {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--muted);
}

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

.post-list-li {
  margin-bottom: 14px;
  padding: 12px;
  border: 2px solid var(--border);
  background: #1f2123;
  box-shadow: 4px 4px 0 var(--shadow);
}

.post-list-li:hover {
  border-color: #7da93a;
}

.post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.post-meta a {
  color: var(--link);
}

.post-list-h3 {
  margin: 7px 0 8px;
}

.post-link {
  display: inline-block;
  position: relative;
  padding-left: 1.05em;
  color: #f1f1f1;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.post-link::before {
  content: "▶";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-56%);
  font-size: 0.62em;
  color: var(--accent);
  opacity: 0;
  transition: opacity 120ms ease;
}

.post-link:hover {
  color: var(--accent-strong);
}

.post-list-li:hover .post-link::before,
.post-link:hover::before {
  opacity: 1;
}

.post-details {
  color: var(--muted);
}

.post,
.page,
.note-card {
  border: 2px solid var(--border);
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--shadow);
}

.post,
.page {
  padding: 16px;
}

.post-header {
  margin-bottom: 14px;
}

.post-title {
  margin-bottom: 8px;
}

.post-content {
  color: #e4e4e4;
  line-height: 1.75;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-bottom: 0.55em;
  color: #f2f2f2;
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.55;
  text-transform: none;
}

.post-content h2 {
  margin-top: 2em;
  font-size: 1.15rem;
}

.post-content h3 {
  margin-top: 1.5em;
  font-size: 1.05rem;
}

.post-content h4 {
  margin-top: 1.3em;
  font-size: 1rem;
}

.post-content strong,
.post-content b {
  color: #f1f1f1;
}

.post-content p {
  margin: 1.25em 0;
}

.post-content ul,
.post-content ol {
  margin: 1.25em 0;
  padding-left: 1.4em;
}

.post-content li {
  margin: 0.4em 0;
}

.post-content li > ul,
.post-content li > ol {
  margin: 0.2em 0;
}

.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1em 0 0 0;
  border-radius: 4px;
  border: 0;
  box-shadow: none;
  image-rendering: auto;
}

.post-content figure {
  margin: 1em 0;
}

.post-content figcaption {
  margin-top: 0.5em;
  color: var(--muted);
  text-align: center;
  font-size: 0.85em;
  font-style: italic;
}

.post-content :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 2px 6px;
  border: 1px solid #5d5d5d;
  border-radius: 4px;
  color: #ebebeb;
  background: #2a2a2a;
}

.post-content .highlighter-rouge {
  margin: 1.25em 0;
  padding: 1px 15px;
  border: 1px solid #474a4d;
  border-radius: 3px;
  background: #171819;
  color: #e7e7e7;
  box-shadow: none;
  overflow-x: auto;
}

.post-content .highlighter-rouge .highlight {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  overflow: visible;
}

.post-content .highlighter-rouge pre {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  font-size: 0.875em;
}

.post-content pre {
  margin: 1.25em 0;
  padding: 1px 15px;
  border: 1px solid #474a4d;
  border-radius: 3px;
  background: #171819;
  color: #e7e7e7;
  box-shadow: none;
  overflow-x: auto;
}

.post-content pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.875em;
}

.post-content blockquote {
  margin: 1.25em 0;
  margin-left: 0;
  padding-left: 1.25em;
  border: 0;
  border-left: 3px solid var(--accent);
  background: transparent;
  color: #cfd3d6;
  font-style: italic;
}

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

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25em 0;
  background: transparent;
}

.post-content th,
.post-content td {
  padding: 0.5em;
  border-bottom: 1px solid #54575a;
  text-align: left;
}

.post-content th {
  color: #f2f2f2;
  background: transparent;
  border-bottom: 1px solid #54575a;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.post-content hr {
  border: 0;
  border-top: 1px dashed #565a5e;
  margin: 2em 0;
}

.note-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.note-card {
  padding: 12px;
}

.note-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.note-card h3 a {
  display: inline-block;
  position: relative;
  padding-left: 1.05em;
  color: #f0f0f0;
}

.note-card h3 a::before {
  content: "▶";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-56%);
  font-size: 0.62em;
  color: var(--accent);
  opacity: 0;
  transition: opacity 120ms ease;
}

.note-card h3 a:hover {
  color: var(--accent-strong);
}

.note-card:hover h3 a::before,
.note-card h3 a:hover::before {
  opacity: 1;
}

.note-meta-line {
  margin: 0 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.note-badge {
  display: inline-flex;
  align-items: center;
  border: 2px solid #575b5f;
  background: #2a2d30;
  padding: 2px 6px;
  color: #e3e3e3;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.note-list li {
  margin: 0;
}

.note-list a {
  color: #ededed;
}

.note-index-sections h2,
.note-facets h2 {
  margin: 0 0 10px;
  color: #f2f2f2;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-transform: none;
}

.note-stats {
  display: grid;
  grid-template-columns: minmax(0, 220px);
  gap: 10px;
  margin: 14px 0 18px;
}

.stat-card {
  border: 2px solid var(--border);
  background: #232629;
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 12px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.stat-card strong {
  display: inline-block;
  margin-top: 6px;
  color: #f2f2f2;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
}

.facet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.facet-col {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 2px solid var(--border);
  background: #222426;
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 10px;
}

.facet-col h3 {
  width: 100%;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.note-post .post-meta a {
  color: var(--link);
}

@media (max-width: 980px) {
  .wrapper {
    padding: 0 12px;
  }

  .header-wrap {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "tagline"
      "nav";
  }

  .site-nav {
    justify-self: start;
  }

  .content-shell {
    padding: 16px;
    box-shadow: 0 0 0 2px #0f0f0f, 4px 4px 0 var(--shadow);
  }

  .note-card-grid,
  .note-list,
  .facet-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .site-title {
    font-size: 0.72rem;
  }

  .site-tagline {
    font-size: 0.78rem;
  }

  .page-link-site {
    font-size: 0.58rem;
    padding: 6px 8px;
  }

  .post,
  .page,
  .note-card {
    box-shadow: 3px 3px 0 var(--shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-link-site {
    transition: none;
  }
}
