:root {
  --header-height: 72px;
}

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

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  background: #fff;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  /* Page entrance/exit transitions */
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

body.page-ready {
  opacity: 1;
  transform: translateY(0);
}

body.page-leaving {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}

/* ── Header ─────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--header-height);
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Menu button (left column) ───────────────────────────── */

.menu-btn {
  justify-self: start;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  color: #444;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.4rem;
  line-height: 1;
}

.menu-btn:hover {
  color: #111;
}

/* ── Side drawer ─────────────────────────────────────────── */

.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: min(280px, 78vw);
  height: 100vh;
  background: #fff;
  border-right: 1px solid #e5e5e5;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 1000;
}

body.menu-open .side-menu {
  transform: translateX(0);
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.side-menu-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  color: #111;
  letter-spacing: 0.03em;
}

.menu-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: #888;
  padding: 0.1rem 0.3rem;
  line-height: 1;
}

.menu-close:hover {
  color: #111;
}

.side-menu-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
}

.side-menu-nav a {
  padding: 0.75rem 1.5rem;
  color: #333;
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.side-menu-nav a:hover {
  background: #f5f5f5;
  color: #111;
}

/* ── Overlay behind drawer ───────────────────────────────── */

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
  z-index: 999;
}

body.menu-open .menu-overlay {
  opacity: 1;
  pointer-events: auto;
}

body.menu-open {
  overflow: hidden;
}

/* ── Title (center column) ───────────────────────────────── */

.site-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 400;
  color: #111;
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-align: center;
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  overflow: hidden;
  background: #fff;
}

/* Character illustration: fixed-size, bottom-anchored, never in flow.
   Per-page sizing via CSS custom properties set on the page class. */
.hero-figure {
  position: absolute;
  bottom: var(--figure-bottom, 0);
  width: var(--figure-width, 900px);
  max-width: none;
  transform: none;
  opacity: var(--figure-opacity, 0.85);
  z-index: 1;
  pointer-events: none;
  user-select: none;
  margin: 0;
}

.hero-left  .hero-figure { left:  var(--figure-left,  0); }
.hero-right .hero-figure { right: var(--figure-right, -80px); }

.hero-figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Text centered in the full hero area */
.hero-content {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 86vw);
  text-align: center;
  z-index: 2;
}

.hero-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 400;
  color: #111;
  margin-bottom: 0.75rem;
  letter-spacing: 0.01em;
}

.hero-sub {
  font-size: 0.95rem;
  color: #666;
  letter-spacing: 0.02em;
}

/* ── Per-page image tuning ───────────────────────────────── */

.hero-home {
  --figure-width:   940px;
  --figure-left:    0;
  --figure-bottom:  0;
  --figure-opacity: 0.9;
}

.hero-notes {
  --figure-width:   500px;
  --figure-right:   -70px;
  --figure-bottom:  0;
  --figure-opacity: 0.88;
}

.hero-projects {
  --figure-width:   520px;
  --figure-right:   -80px;
  --figure-bottom:  0;
  --figure-opacity: 0.88;
}

.hero-about {
  --figure-width:   500px;
  --figure-right:   -60px;
  --figure-bottom:  0;
  --figure-opacity: 0.82;
}

/* ── Responsive ──────────────────────────────────────────── */

/* Tablet: 700px – 1100px — push right and fade subpage images */
@media (max-width: 1100px) {
  .hero-home {
    --figure-opacity: 0.45;
  }

  .hero-notes {
    --figure-width:   500px;
    --figure-right:   -160px;
    --figure-opacity: 0.45;
  }

  .hero-projects {
    --figure-width:   520px;
    --figure-right:   -170px;
    --figure-opacity: 0.45;
  }

  .hero-about {
    --figure-width:   500px;
    --figure-right:   -150px;
    --figure-opacity: 0.40;
  }
}

/* Mobile: below 700px */
@media (max-width: 700px) {
  .hero-home {
    --figure-width:   820px;
    --figure-left:    -40px;
    --figure-opacity: 0.25;
  }

  .hero-notes {
    --figure-width:   460px;
    --figure-right:   -230px;
    --figure-opacity: 0.20;
  }

  .hero-projects {
    --figure-width:   480px;
    --figure-right:   -240px;
    --figure-opacity: 0.20;
  }

  .hero-about {
    --figure-width:   460px;
    --figure-right:   -220px;
    --figure-opacity: 0.20;
  }
}

/* ── Post list (notes / projects index pages) ────────────── */

.post-list {
  max-width: 720px;
  margin: 0 auto;
  padding: 3.5rem 2rem 6rem;
  border-top: 1px solid #f0f0f0;
}

.post-card {
  padding: 1.75rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.post-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 400;
  margin-bottom: 0.25rem;
}

.post-card h2 a {
  color: #111;
  text-decoration: none;
}

.post-card h2 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-card time {
  display: block;
  font-size: 0.8rem;
  color: #aaa;
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

.post-card p {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

.no-posts {
  color: #aaa;
  font-size: 0.9rem;
}

/* ── Individual post page ────────────────────────────────── */

.post-article {
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}

.post-article > header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.post-article > header h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 400;
  color: #111;
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.post-meta {
  display: block;
  font-size: 0.8rem;
  color: #aaa;
  letter-spacing: 0.03em;
}

.post-description {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: #555;
}

.post-content {
  line-height: 1.8;
  color: #222;
}

.post-content h2,
.post-content h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  color: #111;
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}

.post-content h2 { font-size: 1.2rem; }
.post-content h3 { font-size: 1.05rem; }

.post-content p { margin-bottom: 1.25rem; }

.post-content a {
  color: #333;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}

.post-content a:hover { text-decoration-color: #333; }

.post-content code {
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  font-size: 0.85em;
  background: #f5f5f5;
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

.post-content pre {
  background: #f5f5f5;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-content li { margin-bottom: 0.3rem; }

.post-content blockquote {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  border-left: 2px solid #e5e5e5;
  color: #666;
}

.post-content hr {
  border: none;
  border-top: 1px solid #f0f0f0;
  margin: 2rem 0;
}

.back-link {
  display: inline-block;
  margin-top: 3rem;
  font-size: 0.875rem;
  color: #888;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.back-link:hover { color: #111; }
