/* ============================================================
   YJMSTR — geek-academic homepage + blog
   Terminal accents · light & dark themes
   ============================================================ */

:root {
  --bg: #fbfbfd;
  --bg-card: #ffffff;
  --bg-term: #11161c;
  --text: #1f2328;
  --text-soft: #4b5563;
  --text-faint: #9aa3ad;
  --accent: #16a34a;
  --accent-soft: rgba(22, 163, 74, 0.08);
  --border: #e5e7eb;
  --chip-bg: #f1f3f5;
  --code-bg: #f3f4f6;
  --dot: rgba(28, 25, 23, 0.055);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo,
    Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0d1013;
  --bg-card: #14181d;
  --bg-term: #05070a;
  --text: #e2e8f0;
  --text-soft: #94a3b8;
  --text-faint: #64748b;
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.1);
  --border: #232a32;
  --chip-bg: #1a2027;
  --code-bg: #1a2027;
  --dot: rgba(226, 232, 240, 0.055);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

/* subtle dot-grid backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 24px 24px;
  pointer-events: none;
}

.mono { font-family: var(--font-mono); }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ---------------- Banner ---------------- */

.banner {
  width: 100%;
  margin: 0;
  padding: 0;
}

.banner img {
  width: 100%;
  height: 640px;
  object-fit: cover;
  object-position: center 70%;
  display: block;
  border-bottom: 1px solid var(--border);
}

/* ---------------- Layout ---------------- */

.container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 32px 32px 40px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 56px;
  align-items: start;
}

/* ---------------- Sidebar ---------------- */

.sidebar {
  position: sticky;
  top: 56px;
}

.avatar {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  margin-bottom: 18px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
}

.name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.handle {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.tagline {
  font-size: 13px;
  color: var(--text-soft);
  font-style: italic;
  margin-bottom: 18px;
}

.facts {
  list-style: none;
  font-size: 12.5px;
  color: var(--text-soft);
  margin-bottom: 20px;
  line-height: 1.6;
}

.facts li { margin-bottom: 8px; }

.fact-key {
  display: inline-block;
  min-width: 46px;
  color: var(--accent);
  margin-right: 6px;
}

.fact-key::before { content: "> "; color: var(--text-faint); }

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
}

.contact a {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px 10px;
  color: var(--text-soft);
  background: var(--bg-card);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.contact a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ---------------- Terminal card ---------------- */

.terminal {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.terminal-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }

.terminal-title {
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.terminal-body {
  background: var(--bg-term);
  color: #d6deeb;
  padding: 18px 20px;
  font-size: 13.5px;
  line-height: 1.7;
}

.terminal-body p { margin-bottom: 10px; }
.terminal-body p:last-child { margin-bottom: 0; }

.prompt { color: #4ade80; font-weight: 700; }

.term-out { color: #a8b8c8; }

.cursor {
  color: #4ade80;
  animation: blink 1.1s step-end infinite;
}

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

/* ---------------- Sections ---------------- */

section { margin-bottom: 40px; }

h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

h2 .prompt { color: var(--text-faint); font-weight: 500; }

section p {
  color: var(--text-soft);
  margin-bottom: 12px;
}

section p:last-child { margin-bottom: 0; }

section p strong,
li strong { color: var(--text); font-weight: 600; }

/* ---------------- News ---------------- */

.news-list { list-style: none; }

.news-list li {
  color: var(--text-soft);
  margin-bottom: 10px;
}

.news-date {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 1px 8px;
  margin-right: 8px;
  white-space: nowrap;
}

/* ---------------- Blog / posts ---------------- */

.post-list { list-style: none; }

.post-list li { margin-bottom: 18px; }

.post-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
}

.post-title:hover { color: var(--accent); text-decoration: none; }

.post-meta {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.post-excerpt {
  font-size: 13.5px;
  color: var(--text-soft);
  margin-top: 4px;
}

.more {
  font-size: 13px;
  margin-top: 4px;
}

/* ---------------- One-line CV lists ---------------- */

.cv-list { list-style: none; }

.cv-list li {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  align-items: baseline;
}

.cv-list li:last-child { border-bottom: none; }

.cv-date {
  font-size: 12.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.cv-body {
  font-size: 15.5px;
  color: var(--text-soft);
}

.org-logo {
  height: 24px;
  width: auto;
  max-width: 72px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  vertical-align: middle;
  margin-right: 10px;
}

.footer-logo {
  height: 15px;
  width: auto;
  border-radius: 4px;
  vertical-align: -2px;
  margin-right: 5px;
}

/* ---------------- Misc ---------------- */

.misc-list { list-style: none; }

.misc-list li {
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 10px;
}

.tag {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 1px 7px;
  margin-right: 8px;
}

/* ---------------- Game grid (misc) ---------------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.game-card {
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.game-card img {
  width: 100%;
  aspect-ratio: 460 / 215;
  object-fit: cover;
  display: block;
}

.game-meta {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 10.5px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  border-radius: 4px;
  padding: 1px 6px;
  pointer-events: none;
}

/* ---------------- Cover grid (games/index.html) ---------------- */

.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 4px;
}

.cover-card {
  display: block;
  text-decoration: none;
}

.cover-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.cover-card:hover img {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.cover-title {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-soft);
  line-height: 1.35;
}

/* ---------------- Footer ---------------- */

.footer {
  max-width: 1020px;
  margin: 0 auto;
  padding: 20px 32px 44px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer p { font-size: 12px; color: var(--text-faint); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-soft);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ============================================================
   Blog pages (blog/index.html, blog/<slug>.html)
   ============================================================ */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 24px 64px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.page-header .crumb { font-size: 13px; }

.page-header .crumb a { color: var(--text-faint); }
.page-header .crumb a:hover { color: var(--accent); text-decoration: none; }

.article-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 8px;
}

.article-meta {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-bottom: 32px;
}

/* Article typography */

.article h1, .article h2, .article h3, .article h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 32px 0 12px;
  padding: 0;
  border: none;
}

.article h1 { font-size: 24px; }
.article h2 { font-size: 20px; }
.article h3 { font-size: 17px; }

.article p {
  color: var(--text-soft);
  margin-bottom: 16px;
}

.article ul, .article ol {
  color: var(--text-soft);
  margin: 0 0 16px 22px;
}

.article li { margin-bottom: 6px; }

.article strong { color: var(--text); }

.article code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

.article pre {
  background: var(--bg-term);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.article pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.65;
  color: #d6deeb;
}

.article blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px;
  margin-bottom: 16px;
  color: var(--text-faint);
}

.article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.article img { max-width: 100%; border-radius: 8px; }

.article figure {
  margin: 0 0 20px;
  text-align: center;
}

.article figcaption {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 8px;
}

.post-source {
  font-size: 12px;
  color: var(--text-faint);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 24px;
}

.article mjx-container {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

/* ============================================================
   Photo gallery (photos/index.html)
   ============================================================ */

.page-wide { max-width: 980px; }

.gallery-note {
  font-size: 13.5px;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.g-item {
  cursor: zoom-in;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.g-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.g-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.g-item figcaption {
  font-size: 11.5px;
  color: var(--text-faint);
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
}

.lightbox[hidden] { display: none; }

.lb-figure {
  max-width: min(1200px, 88vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lb-figure img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 6px;
}

.lb-figure figcaption {
  color: #cbd5e1;
  font-size: 13px;
  text-align: center;
}

.lb-close, .lb-prev, .lb-next {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e2e8f0;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  border-color: #4ade80;
  color: #4ade80;
}

.lb-close {
  position: absolute;
  top: 20px;
  right: 20px;
}

@media (max-width: 640px) {
  .lightbox { padding: 12px; }
  .lb-prev, .lb-next { display: none; }
}

.article table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 16px;
  font-size: 14px;
}

.article th, .article td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.article th { background: var(--chip-bg); }

/* Blog index list */

.blog-index { max-width: 720px; }

.index-post {
  display: flex;
  gap: 22px;
  align-items: baseline;
  padding: 24px 4px;
  border-bottom: 1px solid var(--border);
  transition: background 0.18s ease;
}

.index-post:last-child { border-bottom: none; }

.index-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-faint);
  opacity: 0.45;
  min-width: 48px;
  transition: color 0.18s ease, opacity 0.18s ease;
}

.index-body { flex: 1; min-width: 0; }

.index-post .post-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
  display: inline-block;
  transition: transform 0.18s ease, color 0.18s ease;
}

.index-post:hover { background: var(--accent-soft); }
.index-post:hover .index-num { color: var(--accent); opacity: 1; }
.index-post:hover .post-title { transform: translateX(6px); color: var(--accent); text-decoration: none; }

.index-post .post-meta { display: block; margin-top: 6px; }

.index-post .post-excerpt { margin-top: 8px; margin-bottom: 0; }

/* Article page upgrades */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 60;
  transition: width 0.08s linear;
}

.article-title .prompt {
  color: var(--accent);
  font-weight: 500;
  margin-right: 6px;
}

.article h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.article h2::before {
  content: "~/";
  font-family: var(--font-mono);
  font-size: 0.78em;
  font-weight: 500;
  color: var(--accent);
  margin-right: 8px;
}

.article pre {
  position: relative;
  padding-top: 40px;
}

.article pre::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 17px 0 0 #febc2e, 34px 0 0 #28c840;
}

.article blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: var(--text-soft);
}

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

.eof {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 0.2em;
  margin: 40px 0 8px;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 12px;
  font-size: 13px;
}

.post-nav a {
  color: var(--text-soft);
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-nav a:hover { color: var(--accent); text-decoration: none; }

.post-nav .nav-next { margin-left: auto; text-align: right; }

::selection { background: var(--accent); color: #fff; }

/* ---------------- Responsive ---------------- */

@media (max-width: 820px) {
  .banner img { height: 320px; }

  .container {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 32px;
  }

  .sidebar { position: static; text-align: left; }

  .avatar { max-width: 120px; }

  .cv-list li { grid-template-columns: 1fr; gap: 2px; }
}

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