/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #141210;
  --surface: #1a1714;
  --text: #e4ddd6;
  --text-body: #c4bdb4;
  --text-dim: #9a9288;
  --text-muted: #6b655e;
  --accent: #c89060;
  --accent-dim: rgba(200,144,96,0.12);
  --gold: #d4a870;
  --border: #26231e;
  --border-light: #1e1b18;
  --sidebar-w: 200px;
  --margin-w: 110px;
}

html {
  font-size: 18px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: subpixel-antialiased;
}

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: Georgia, 'Noto Serif', 'Times New Roman', serif;
  line-height: 1.75;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color 0.25s; }
a:hover { color: var(--gold); }

/* === SUBTLE AMBIENCE === */
body::after {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 70% 10%, rgba(200,144,96,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 30% 90%, rgba(180,140,100,0.03) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

/* === LAYOUT === */
.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 56px 24px 40px;
  text-align: right;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg);
}

.sidebar-inner { flex: 1; display: flex; flex-direction: column; }

.site-title {
  font-family: Georgia, serif;
  font-size: 22px;
  color: var(--text);
  letter-spacing: 4px;
  display: block;
  transition: color 0.3s;
}
.site-title:hover { color: var(--accent); }
.site-title::after {
  content: '';
  display: block;
  width: 20px; height: 1px;
  background: var(--accent);
  margin: 16px 0 16px auto;
  opacity: 0.5;
}

.main-nav {
  display: flex; flex-direction: column; gap: 2px;
  font-family: 'Courier New', 'SF Mono', monospace;
  font-size: 12px;
  flex: 1;
  letter-spacing: 1px;
}

.nav-link {
  color: var(--text-muted);
  padding: 5px 0;
  transition: all 0.25s;
}
.nav-link:hover { color: var(--accent); }

.sidebar-footer {
  font-family: 'Courier New', monospace;
  font-size: 9px; color: var(--text-muted);
  letter-spacing: 2px; padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* === MAIN === */
.main-content { flex: 1; padding: 56px 56px 100px; 
}

/* === HOMEPAGE === */
.tagline {
  font-size: 14px; font-style: italic;
  color: var(--text-dim);
  margin-bottom: 48px;
}

.post-card {
  margin-bottom: 36px; padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.3s;
}
.post-card:last-child { border-bottom: none; }
.post-card:hover { padding-left: 8px; }

.post-date {
  font-family: 'Courier New', monospace;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 2px; margin-bottom: 6px;
}

.post-title {
  font-size: 26px; font-weight: normal;
  line-height: 1.25; margin-bottom: 8px;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }

.post-desc {
  font-size: 14px; color: var(--text-dim);
  line-height: 1.6; margin-bottom: 10px;
}

.post-tags { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.tag {
  font-family: 'Courier New', monospace;
  font-size: 9px; color: var(--text-muted);
  letter-spacing: 1px;
}
.read-time {
  font-family: 'Courier New', monospace;
  font-size: 9px; color: var(--text-muted);
  margin-left: auto;
}

/* === POST DETAIL === */
.post-detail { display: flex; gap: 32px; }

.post-margin {
  width: var(--margin-w); flex-shrink: 0;
  padding-top: 44px;
}

.margin-section { margin-bottom: 24px; }

.margin-label {
  font-family: 'Courier New', monospace;
  font-size: 9px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 2px;
  display: block; margin-bottom: 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border-light);
}

.margin-tag, .margin-toc-item {
  font-family: 'Courier New', monospace;
  font-size: 9px; color: var(--text-dim);
  line-height: 2.4; text-align: right;
  transition: color 0.2s;
}
.margin-tag:hover, .margin-toc-item:hover { color: var(--accent); cursor: pointer; }

.post-body { flex: 1; max-width: 720px; }

.back-link {
  font-family: 'Courier New', monospace;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 2px;
  display: inline-block; margin-bottom: 24px;
  transition: color 0.25s;
}
.back-link:hover { color: var(--accent); }

.post-title-main {
  font-family: Georgia, serif;
  font-size: 34px; font-weight: normal;
  color: var(--text); line-height: 1.2;
  margin-bottom: 14px;
}

.post-meta-line {
  font-family: 'Courier New', monospace;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 2px;
  margin-bottom: 36px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.meta-sep { margin: 0 8px; color: var(--border); }

/* === POST CONTENT === */
.post-content {
  font-size: 18px; line-height: 1.9;
  color: var(--text-body);
}
.post-content p { margin-bottom: 22px; }
.post-content strong { color: var(--text); }
.post-content em { color: var(--accent); font-style: italic; }
.post-content h2 {
  font-family: Georgia, serif;
  font-size: 22px; font-weight: normal;
  color: var(--text); margin: 44px 0 16px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-light);
}
.post-content h3 {
  font-family: Georgia, serif;
  font-size: 18px; font-weight: normal;
  color: var(--text); margin: 32px 0 12px;
}
.post-content code {
  font-family: 'Courier New', monospace;
  font-size: 14px; background: var(--surface);
  padding: 2px 7px; color: var(--accent);
}
.post-content pre {
  background: var(--surface);
  border-left: 2px solid var(--accent);
  padding: 20px 24px; margin: 26px 0;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 14px; line-height: 1.7; color: #c8c0b8;
}
.post-content pre code { background: none; padding: 0; color: inherit; }
.post-content blockquote {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 20px; margin: 26px 0;
  color: var(--text-dim); font-style: italic;
}
.post-content a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 1px;
}
.post-content a:hover { color: var(--gold); border-bottom-color: var(--gold); }
.post-content ul, .post-content ol { margin: 20px 0; padding-left: 26px; }
.post-content li { margin-bottom: 8px; }
.post-content li::marker { color: var(--accent); }
.post-content hr { border: none; border-top: 1px solid var(--border-light); margin: 44px 0; }
.post-content img { max-width: 100%; height: auto; }
.post-content table { width: 100%; border-collapse: collapse; margin: 26px 0; font-size: 14px; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.post-content th {
  font-family: 'Courier New', monospace;
  font-size: 10px; color: var(--accent); background: var(--surface);
  letter-spacing: 1px;
}

/* === PAGE HEADER === */
.page-header { margin-bottom: 40px; }
.terminal-hint {
  font-family: 'Courier New', monospace;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 2px;
}
.terminal-hint::before { content: '> '; color: var(--accent); }

/* === ABOUT === */
.portrait-placeholder {
  width: 100%; max-width: 180px; aspect-ratio: 1;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
  font-family: 'Courier New', monospace; font-size: 9px;
  color: var(--text-muted); letter-spacing: 2px;
}
.about-name {
  font-family: Georgia, serif;
  font-size: 32px; font-weight: normal;
  color: var(--text); margin-bottom: 10px;
}
.about-tagline {
  font-family: 'Courier New', monospace;
  font-size: 10px; letter-spacing: 2px;
  color: var(--text-dim); margin-bottom: 28px;
}
.about-bio { font-size: 17px; line-height: 1.9; color: var(--text-body); margin-bottom: 28px; }
.about-bio p { margin-bottom: 16px; }
.about-links {
  padding-top: 16px; border-top: 1px solid var(--border);
  font-family: 'Courier New', monospace; font-size: 10px; letter-spacing: 1px;
}
.social-link { color: var(--text-dim); }
.social-link:hover { color: var(--accent); }
.link-sep { margin: 0 10px; color: var(--text-muted); }

/* === PROJECTS & FRIENDS === */
.projects-content, .friends-content { font-size: 16px; line-height: 1.9; color: var(--text-body); }
.friends-content a { color: var(--accent); }
.friends-content a:hover { color: var(--gold); }
.projects-content h3 {
  font-family: Georgia, serif; font-size: 17px; font-weight: normal;
  color: var(--text); margin: 24px 0 8px;
}
.projects-content p { margin-bottom: 12px; }
.friends-content ul { list-style: none; padding: 0; }
.friends-content li {
  margin-bottom: 12px; padding: 12px 16px;
  border: 1px solid var(--border-light);
  transition: border-color 0.3s;
}
.friends-content li:hover { border-color: var(--accent); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: baseline; justify-content: space-between;
    padding: 14px 18px; border-right: none;
    border-bottom: 1px solid var(--border); text-align: left;
  }
  .site-title { font-size: 17px; letter-spacing: 2px; }
  .site-title::after { display: none; }
  .main-nav { flex-direction: row; gap: 12px; font-size: 10px; }
  .sidebar-footer { display: none; }
  .main-content { padding: 28px 20px 60px; max-width: 100%; }
  .post-detail { flex-direction: column; }
  .post-margin { width: 100%; padding-top: 0; order: 2; }
  .margin-tag, .margin-toc-item { display: inline-block; margin-right: 12px; text-align: left; }
  .post-body { max-width: 100%; }
  .post-title { font-size: 21px; }
  .post-title-main { font-size: 26px; }
}

/* === POST LAYOUT OVERRIDE - margin to right === */
.post-detail {
  flex-direction: row;
}

.post-margin {
  order: 2;
  padding-top: 44px;
  width: 180px;
}

.post-body {
  order: 1;
  flex: 1;
  max-width: none;
  padding-right: 32px;
}

.margin-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 12px;
  text-transform: none;
  font-family: Georgia, serif;
  font-style: italic;
}

.margin-tag, .margin-toc-item {
  font-size: 11px;
  line-height: 2.0;
  color: var(--text-dim);
  text-align: left;
  font-family: Georgia, 'Noto Serif', serif;
  transition: color 0.2s;
  padding: 2px 0;
}

.margin-tag:hover, .margin-toc-item:hover {
  color: var(--accent);
  padding-left: 6px;
}

.margin-section {
  margin-bottom: 28px;
}
