/* ==========================================================
   Site (blog index + posts) — dark theme matching the home.
   ========================================================== */
:root {
  --bg: #03060d;
  --bg-elev: #0a0e1c;
  --fg: #f4f5f7;
  --muted: #b8bfcc;
  --muted-2: #8a92a3;
  --accent: #8fd6ff;
  --accent-warm: #ffc28a;
  --border: rgba(255, 255, 255, 0.10);
  --display: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --maxw: 720px;
}

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

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.page-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 20% -10%, rgba(140, 170, 255, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 110%, rgba(255, 170, 100, 0.06) 0%, transparent 50%),
    var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Top nav ---------- */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 18px 28px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  letter-spacing: 0.02em;
}
/* (margin-left:auto is set inside .site-nav__primary itself below) */
.site-nav .nav-toggle { margin-left: 16px; }
.site-nav__brand {
  color: var(--fg) !important;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  line-height: 1;
}
.site-nav__brand:hover { text-decoration: none; }
.brand-name {
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg);
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
@media (max-width: 720px) {
  /* Keep "π · Name" visible on small screens; just trim sizes so they fit. */
  .brand-pi   { font-size: 28px; }
  .brand-name { font-size: 13px; padding-left: 10px; }
  .site-nav__brand { gap: 10px; }
}

/* π logo mark */
.brand-pi {
  font-family: var(--display);
  font-style: italic;
  font-weight: 600;
  font-size: 38px;
  line-height: 1;
  background: linear-gradient(135deg, #8fd6ff 0%, #c9a8ff 60%, #ffc28a 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  /* Source Serif italic π sits visually ~7% above its box center;
     nudge down so it middle-aligns with the upright Inter name. */
  transform: translateY(0.03em);
  transition: transform 0.25s ease, filter 0.25s ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.site-nav__brand:hover .brand-pi {
  transform: translateY(0.03em) scale(1.08) rotate(-3deg);
  filter: drop-shadow(0 2px 6px rgba(143, 214, 255, 0.5));
}
/* Primary inline links — pushed to the right edge */
.site-nav__primary {
  display: flex;
  gap: 22px;
  margin: 0 0 0 auto;   /* margin-left: auto pushes to the right */
  padding: 0;
  list-style: none;
}
.site-nav__primary a {
  color: var(--muted) !important;
  transition: color 0.2s ease;
}
.site-nav__primary a:hover { color: var(--fg) !important; text-decoration: none; }
.site-nav__primary a.is-active { color: var(--fg) !important; }

/* Social-icon dropdown panel */
.site-nav__dropdown {
  position: absolute;
  top: calc(100% - 4px);
  right: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(3, 6, 13, 0.95);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}
.site-nav.is-open .site-nav__dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.nav-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.2s ease, transform 0.2s ease;
}
.nav-social-link:hover {
  color: var(--fg) !important;
  transform: translateY(-1px);
}
.nav-icon { display: block; }

/* .site-nav needs to be a positioning context for the absolute dropdown */
.site-nav { position: relative; }
/* Hamburger button (≡ → ✕) */
.nav-toggle {
  display: flex;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  width: 40px; height: 36px;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  transition: border-color 0.2s ease;
}
.nav-toggle:hover { border-color: var(--accent); }
.nav-toggle__bar {
  display: block;
  width: 100%; height: 2px;
  background: var(--fg);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.site-nav.is-open .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-nav.is-open .nav-toggle__bar:nth-child(2) { opacity: 0; }
.site-nav.is-open .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Mobile (≤720px) ---------- */
@media (max-width: 720px) {
  .site-nav { padding: 12px 16px; }

  /* Hamburger sits at the far-right on mobile */
  .site-nav .nav-toggle { margin-left: auto; }

  .site-nav__primary {
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    font-size: 14px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 4px;
    transition: max-height 0.35s ease, opacity 0.2s ease, padding 0.3s ease;
  }
  .site-nav.is-open .site-nav__primary {
    max-height: 60vh;
    opacity: 1;
    padding: 12px 4px 8px;
    border-bottom: 1px solid var(--border);
  }

  .site-nav__dropdown {
    order: 4;
    position: static;
    width: 100%;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0 4px;
    transform: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.35s ease, opacity 0.2s ease, padding 0.3s ease;
    gap: 20px;
  }
  .site-nav.is-open .site-nav__dropdown {
    opacity: 1;
    pointer-events: auto;
    max-height: 60px;
    padding: 10px 4px;
  }
}

/* ---------- Page shell ---------- */
.page-main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 64px 28px 80px;
}

.page-header {
  margin-bottom: 48px;
}
.page-eyebrow {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}
.page-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.page-subtitle {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- Post list ---------- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.post-list__item {
  border-top: 1px solid var(--border);
}
.post-list__item:last-child {
  border-bottom: 1px solid var(--border);
}
.post-list__link {
  display: block;
  padding: 22px 0;
  color: inherit !important;
  text-decoration: none !important;
  transition: padding-left 0.2s ease;
}
.post-list__link:hover {
  padding-left: 8px;
}
.post-list__link:hover .post-list__title {
  color: var(--accent);
}
.post-list__date {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.post-list__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.4rem;
  line-height: 1.3;
  margin: 0 0 8px;
  color: var(--fg);
  transition: color 0.2s ease;
}
.post-list__tags {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.post-list__tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------- Single post ---------- */
.post-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.post-meta {
  color: var(--muted-2);
  font-size: 13px;
  margin: 0 0 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.post-meta time { letter-spacing: 0.04em; }

.post-content {
  font-family: var(--display);
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--muted);
}
.post-content p { margin: 0 0 1.1em; }
.post-content strong { color: var(--fg); }
.post-content a { color: var(--accent); }
.post-content h1,
.post-content h2,
.post-content h3 {
  font-family: var(--display);
  color: var(--fg);
  margin: 2em 0 0.5em;
  line-height: 1.25;
}
.post-content h2 { font-size: 1.55rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content blockquote {
  margin: 1.4em 0;
  padding: 0 0 0 18px;
  border-left: 3px solid var(--accent);
  color: var(--fg);
  font-style: italic;
}
.post-content code {
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
  color: var(--fg);
}
.post-content pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}
.post-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
}
.post-content img,
.post-content iframe {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.post-content ul,
.post-content ol {
  padding-left: 1.4em;
  margin: 0 0 1.1em;
}
.post-content li { margin-bottom: 0.4em; }

.post-header { margin-bottom: 32px; }
.post-header .page-eyebrow a { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 28px;
  font-size: 13px;
  color: var(--muted-2);
  text-align: center;
}
.site-footer a { color: var(--muted); }
