/* E73RN4L v5 — flex on .list-layout (not main), taller E, aligned brand */

:root {
  --black: #030303;
  --ink: #151515;
  --muted: #5d5a53;
  --line: #d8d2c3;
  --line-soft: rgba(3, 3, 3, 0.08);
  --tan: #f7f5ee;
  --panel: #fffdf6;
  --orange: #fe8752;
  --brick: #c25b2f;
  --green: #242d29;
  --cyan: #b3d6d3;
  --code-bg: #efeadf;
  --radius: 12px;
  --serif: Georgia, "Times New Roman", "Songti SC", "STSong", "Noto Serif SC", serif;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, "Cascadia Code", monospace;
  --wrap: 1080px;
  --ease: 180ms ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--tan);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brick); }
img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--orange); color: var(--black); }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.site-header, main, .site-footer, .progress { position: relative; z-index: 1; }
.site-header { z-index: 30; }

.wrap {
  width: min(100% - 40px, var(--wrap));
  margin-inline: auto;
}

.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 50; pointer-events: none;
}
.progress span { display: block; height: 100%; width: 0; background: var(--orange); }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.site-header {
  border-bottom: 1px solid var(--line-soft);
  background: rgba(247, 245, 238, 0.92);
  position: sticky; top: 0;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 0;
  animation: rise-in 0.45s ease both;
}
.brand { display: flex; align-items: baseline; gap: 12px; color: var(--black); }
.brand:hover { color: var(--black); }
.brand-mark {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--brick);
  display: inline-block;
  transform: scaleY(1.08) scaleX(0.94);
  transform-origin: center bottom;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.05;
}
.brand-text strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.brand-text em {
  font-style: normal; font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  line-height: 1.2;
}
.site-nav { display: flex; gap: 18px; font-size: 13px; font-weight: 600; }
.site-nav a { color: var(--muted); transition: color var(--ease); }
.site-nav a:hover, .site-nav a.is-active { color: var(--black); }

.site-footer {
  margin-top: 64px; border-top: 1px solid var(--line);
  padding: 28px 0 40px; color: var(--muted); font-size: 13px;
}
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-inner strong { color: var(--ink); font-family: var(--serif); }
.dot { margin: 0 8px; opacity: 0.55; }

/* main is just a container; TWO-COLUMN lives on .list-layout */
.layout-list {
  padding-top: 24px;
  padding-bottom: 20px;
}
.list-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 36px;
  width: 100%;
}
.list-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 760px;
}
.side-panel {
  flex: 0 0 260px;
  width: 260px;
  max-width: 260px;
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise-in 0.5s ease 0.05s both;
}

.list-hero {
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  animation: rise-in 0.45s ease both;
}
.eyebrow {
  margin: 0 0 8px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--brick);
}
.list-hero h1, .not-found h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 700; color: var(--black); line-height: 1.15;
}
.lede { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.day-block { margin: 24px 0 4px; }
.day-label {
  margin-bottom: 6px;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--muted);
}
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item {
  position: relative;
  padding: 15px 10px 15px 16px;
  border-top: 1px solid var(--line-soft);
  border-radius: 0 10px 10px 0;
  transition: background 200ms ease;
}
.post-item:last-child { border-bottom: 1px solid var(--line-soft); }
.post-item:hover {
  background: linear-gradient(90deg, rgba(254, 135, 82, 0.14), rgba(254, 135, 82, 0.03) 50%, transparent);
}
.post-accent {
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 99px;
  background: var(--orange);
  opacity: 0.9;
  transform: scaleY(0.55);
  transform-origin: top center;
  transition: transform 220ms ease, opacity 220ms ease, width 220ms ease;
}
.post-item:hover .post-accent {
  transform: scaleY(1);
  opacity: 1;
  width: 4px;
}
.post-link {
  display: inline-block;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--black);
  line-height: 1.35;
}
.post-link:hover { color: var(--brick); }
.post-sum { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.post-meta { margin-top: 6px; font-size: 12px; color: var(--muted); }

.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 32px 0 16px; font-size: 13px; font-weight: 600;
}
.pager a {
  display: inline-flex; align-items: center; min-height: 38px;
  padding: 8px 12px; color: var(--black);
  border-bottom: 1px solid var(--line);
}
.pager a:hover { color: var(--brick); border-bottom-color: var(--orange); }
.page-no { color: var(--muted); font-weight: 500; }
.empty { color: var(--muted); padding: 40px 0; }

.side-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
}
.side-label {
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.14em; color: var(--muted);
  margin-bottom: 10px;
}
.avatar-wrap { margin-bottom: 10px; }
.avatar-photo {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--green);
}
.profile-card h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  color: var(--black);
  line-height: 1.2;
}
.profile-card p { margin: 0 0 3px; font-size: 13px; }
.profile-card .muted { color: var(--muted); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips span {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(254, 135, 82, 0.14);
  color: var(--brick);
  font-size: 11px; font-weight: 700;
}
.focus-list { list-style: none; margin: 0; padding: 0; }
.focus-list li {
  display: flex; gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.focus-list li:first-child { border-top: 0; padding-top: 0; }
.focus-list span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px; font-weight: 700; min-width: 18px;
}
.friend-card {
  background: #e7f3f1;
  border-color: rgba(36, 45, 41, 0.12);
}
.friend-card .side-label { color: var(--muted); }
.friend {
  display: flex; align-items: center; gap: 12px;
  color: var(--green);
}
.friend:hover { color: var(--brick); }
.friend-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: #b3d6d3;
  color: var(--green);
  font-family: var(--serif);
  font-weight: 700; font-size: 15px;
  flex: 0 0 auto;
}
.friend-body {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex: 1; min-width: 0;
}
.friend-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.friend-text strong { font-size: 13.5px; line-height: 1.2; }
.friend-text small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
.friend:hover .friend-text small { color: var(--brick); }
.friend-body em { font-style: normal; color: #7aa8a4; }
.contact {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 0; color: var(--ink);
}
.contact:hover { color: var(--brick); }
.contact span { color: var(--muted); font-size: 12px; letter-spacing: 0.06em; }
.contact strong { font-size: 13.5px; }
.small { font-size: 12px; margin-top: 4px; }

/* article */
.layout-post { max-width: 760px; }
.article { padding: 36px 0 20px; max-width: 760px; }
.article-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  animation: rise-in 0.45s ease both;
}
.article-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--black);
}
.article-meta {
  margin-top: 12px;
  display: flex; align-items: center; flex-wrap: wrap;
  color: var(--muted); font-size: 13px;
}
.article-body {
  font-size: 16.5px;
  line-height: 1.85;
  animation: rise-in 0.45s ease 0.05s both;
}
.article-body > *:first-child { margin-top: 0; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
  font-family: var(--serif);
  color: var(--black);
  line-height: 1.3;
  scroll-margin-top: 72px;
}
.article-body h1 {
  margin: 2em 0 0.7em;
  font-size: 1.6em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line);
}
.article-body h2 { margin: 1.8em 0 0.6em; font-size: 1.3em; }
.article-body h3 { margin: 1.45em 0 0.5em; font-size: 1.08em; }
.article-body p { margin: 1em 0; }
.article-body a {
  color: var(--brick);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.article-body a:hover { color: var(--orange); }
.article-body ul, .article-body ol { margin: 1em 0; padding-left: 1.4em; }
.article-body li { margin: 0.4em 0; }
.article-body blockquote {
  margin: 1.4em 0;
  padding: 12px 18px;
  border-left: 3px solid var(--orange);
  background: rgba(254, 135, 82, 0.08);
  color: var(--muted);
}
.article-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.article-body table {
  width: 100%; margin: 1.4em 0; border-collapse: collapse;
  background: var(--panel); font-size: 0.95em;
}
.article-body th, .article-body td {
  border: 1px solid rgba(3,3,3,0.22);
  padding: 10px 12px; text-align: left; vertical-align: top;
}
.article-body th { background: var(--code-bg); font-weight: 700; }
.article-body img {
  margin: 1.4em auto;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
}

.article-body :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.12em 0.4em;
  border-radius: 5px;
  background: var(--code-bg);
  border: 1px solid rgba(3,3,3,0.08);
}
.article-body pre,
.article-body .highlight pre,
.article-body .highlight > pre {
  position: relative;
  margin: 1.5em 0;
  padding: 18px 16px 16px;
  overflow-x: auto;
  border: 1px solid rgba(3,3,3,0.18);
  border-radius: var(--radius);
  background: var(--code-bg) !important;
  color: var(--ink) !important;
  line-height: 1.7;
  font-family: var(--mono);
  font-size: 13.5px;
}
.article-body pre::before,
.article-body .highlight pre::before {
  content: "CODE";
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.article-body pre code,
.article-body .highlight pre code {
  display: block;
  padding: 0; border: 0;
  background: transparent !important;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  white-space: pre;
}

.article-foot {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.back {
  display: inline-flex; align-items: center;
  min-height: 38px; padding: 8px 2px;
  font-size: 13px; font-weight: 700; color: var(--black);
  border-bottom: 1px solid transparent;
}
.back:hover { color: var(--brick); border-bottom-color: var(--orange); }
.not-found { padding: 80px 0; }

.article-stats {
  display: flex; gap: 18px; margin: 10px 0 0;
  font-size: 12px; color: var(--muted);
}
.article-stats b { margin-right: 6px; font-weight: 700; }
.article-stats strong { color: var(--black); font-weight: 700; }

#toc-container {
  position: fixed;
  top: 92px;
  right: max(12px, calc((100vw - var(--wrap)) / 2 - 20px));
  width: 170px;
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 246, 0.94);
  font-size: 12px;
  z-index: 20;
}
#toc-container.collapsed #toc-list { display: none; }
.toc-title {
  margin-bottom: 8px; font-size: 10px; font-weight: 800;
  letter-spacing: 0.12em; color: var(--muted);
}
.toc-toggle {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); cursor: pointer; font-size: 12px; line-height: 1;
}
#toc-list { list-style: none; margin: 0; padding: 0; }
#toc-list a {
  display: block; padding: 4px 6px; border-radius: 6px;
  color: var(--muted); line-height: 1.4;
}
#toc-list a:hover, #toc-list a.active {
  color: var(--black); background: rgba(254, 135, 82, 0.14);
}
.toc-h3 { padding-left: 10px !important; }
.toc-h4 { padding-left: 18px !important; font-size: 11px; }

@media (max-width: 1100px) {
  #toc-container { display: none; }
}
@media (max-width: 900px) {
  .list-layout { flex-direction: column; }
  .side-panel {
    position: static;
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .profile-card { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .header-inner { padding: 14px 0; }
  .brand-text em { display: none; }
  .side-panel { grid-template-columns: 1fr; }
  .article-body { font-size: 15.5px; }
  .post-link { font-size: 17.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
