@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #18181b;
  --muted: #71717a;
  --accent: #3f3f46;
  --border: #e4e4e7;
  --header: #f4f4f5;
}

body.dark {
  --bg: #09090b;
  --card: #18181b;
  --text: #fafafa;
  --muted: #a1a1aa;
  --accent: #d4d4d8;
  --border: #27272a;
  --header: #18181b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text) !important;
  transition: background 0.25s ease, color 0.25s ease;
}

.container {
  width: min(100%, 1024px);
  margin: 0 auto;
  padding: 2rem 1rem;
}

.site-header {
  background: var(--header);
  color: var(--text);
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-header h1.site-logo {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.site-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.site-nav button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.site-nav button:hover {
  background: rgba(99, 102, 107, 0.14);
}

.theme-btn {
  color: var(--text);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0 !important;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none !important;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.theme-btn svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: currentColor;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-btn .icon-sun {
  display: none;
}

body.dark .theme-btn .icon-moon {
  display: none;
}

body.dark .theme-btn .icon-sun {
  display: block;
  animation: spinIn 0.3s ease forwards;
}

@keyframes spinIn {
  0% {
    transform: rotate(-45deg) scale(0.8);
    opacity: 0;
  }

  100% {
    transform: rotate(0) scale(1);
    opacity: 1;
  }
}

.theme-btn:hover {
  background: rgba(99, 102, 107, 0.15);
  transform: translateY(-1px);
}

.site-nav .site-action {
  margin-left: 0.5rem;
}


.page-section {
  margin-top: 2rem;
}

.hidden {
  display: none !important;
}

.posts {
  display: grid;
  gap: 2rem;
  margin-top: 1rem;
}

.post-card,
.post-detail,
.about-card {
  background: transparent;
  padding: 2.2rem 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
}

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

.post-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 2rem;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.post-card:hover {
  opacity: 0.6;
}

.post-card img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 0.6rem;
}

.post-card h2 {
  margin: 0;
  font-size: 1.25rem;
}

.post-card .meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.post-card p,
.post-detail p,
.about-grid p {
  margin: 0;
  color: var(--text);
}

.post-card .read-more,
.button {
  display: inline-block;
  margin-top: 0.7rem;
  text-decoration: none;
  color: #ffffff;
  background: var(--accent);
  border: none;
  border-radius: 0.5rem;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

.post-detail {
  margin-top: 1rem;
}

/* Markdown styling */
.post-detail h1,
.post-detail h2,
.post-detail h3,
.post-detail h4,
.post-detail h5,
.post-detail h6 {
  color: var(--text);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  line-height: 1.3;
}

.post-detail h1 {
  font-size: 2em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3em;
}

.post-detail h2 {
  font-size: 1.5em;
}

.post-detail h3 {
  font-size: 1.25em;
}

.post-detail p {
  margin: 1em 0;
  line-height: 1.6;
}

.post-detail blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 1em;
  margin: 1.5em 0;
  color: var(--muted);
  font-style: italic;
}

.post-detail ul,
.post-detail ol {
  margin: 1em 0;
  padding-left: 2em;
}

.post-detail li {
  margin: 0.5em 0;
  line-height: 1.6;
}

.post-detail code {
  background: rgba(0, 0, 0, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
}

.post-detail pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5em;
  padding: 1em;
  overflow-x: auto;
  margin: 1em 0;
}

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

.post-detail img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5em;
  margin: 1em 0;
}

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

.post-detail a:hover {
  text-decoration: underline;
}

.post-detail table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.post-detail th,
.post-detail td {
  border: 1px solid var(--border);
  padding: 0.5em;
  text-align: left;
}

.post-detail th {
  background: var(--header);
  font-weight: 600;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 1.2rem;
  align-items: start;
}

.about-grid img {
  width: 100%;
  max-width: 240px;
  max-height: 240px;
  border-radius: 0.75rem;
  object-fit: cover;
}

.site-footer {
  text-align: left;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4rem;
}

@media (max-width: 850px) {

  .about-grid,
  .post-card {
    grid-template-columns: 1fr;
  }

  .post-card img {
    height: 180px;
  }
}


.markdown-body {
  --base-size-16: 1rem;
  --base-size-24: 1.5rem;
  --base-size-4: 0.25rem;
  --base-size-40: 2.5rem;
  --base-size-8: 0.5rem;
  --base-text-weight-medium: 500;
  --base-text-weight-normal: 400;
  --base-text-weight-semibold: 600;
  --fontStack-monospace: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
  --fontStack-sansSerif: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --fgColor-accent: Highlight;
  background-color: transparent !important;
  border-left-color: var(--border) !important;
}

body.dark .markdown-body .callout,
body.dark .markdown-body .source {
  background-color: var(--card) !important;
  border-color: var(--border) !important;
}

body.dark .markdown-body img {
  filter: brightness(0.9) contrast(1.1);
}

/* Fix layout issues in post pages */
.markdown-body {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  min-width: 0 !important;
  border: none !important;
  border-radius: 0 !important;
}

.markdown-body body {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  line-height: 1.5 !important;
  white-space: pre-wrap !important;
  color: var(--text) !important;
}

.markdown-body article {
  margin: 0;
  padding: 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 1rem 0.5rem;
  }

  @media (max-width: 600px) {
    .site-header-inner {
      flex-direction: column;
      text-align: center;
      gap: 1rem;
    }

    .site-nav {
      justify-content: center;
    }
  }

  .site-header h1 {
    font-size: 1.8rem;
  }

  .site-header p {
    font-size: 0.9rem;
  }

  .site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  .site-nav button,
  .site-nav a {
    flex: 1;
    min-width: 80px;
    text-align: center;
  }

  .theme-btn {
    width: 2rem;
    height: 2rem;
  }

  .posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .post-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .post-card img {
    width: 100%;
    height: auto;
  }

  .about-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .button {
    width: 100%;
    text-align: center;
  }

  .markdown-body {
    font-size: 0.9rem;
  }

  .markdown-body h1 {
    font-size: 1.5rem;
  }

  .markdown-body h2 {
    font-size: 1.25rem;
  }

  .markdown-body h3 {
    font-size: 1.125rem;
  }
}

/* Embedded Image Container */
.markdown-body .image a {
  display: inline-block;
  border-radius: 0.6rem;
  overflow: hidden;
  cursor: zoom-in;
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox-modal.active {
  opacity: 1;
}

.lightbox-modal img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.lightbox-modal.active img {
  transform: scale(1);
}

/* Notion Dark Mode Overrides */
body.dark .markdown-body,
body.dark .markdown-body * {
  border-color: var(--border) !important;
}

body.dark .markdown-body {
  color: var(--text) !important;
}

body.dark .markdown-body .page,
body.dark .markdown-body .page-body,
body.dark .markdown-body p,
body.dark .markdown-body h1,
body.dark .markdown-body h2,
body.dark .markdown-body h3,
body.dark .markdown-body h4,
body.dark .markdown-body h5,
body.dark .markdown-body h6,
body.dark .markdown-body li {
  color: var(--text) !important;
}

body.dark .markdown-body .bookmark-title,
body.dark .markdown-body a.bookmark {
  color: var(--text) !important;
}

body.dark .markdown-body .bookmark-description,
body.dark .markdown-body th,
body.dark .markdown-body time,
body.dark .markdown-body figcaption,
body.dark .markdown-body .user,
body.dark .markdown-body .pdf-relative-link-path {
  color: var(--muted) !important;
}

body.dark .markdown-body hr {
  border-bottom: 1px solid var(--border) !important;
}

body.dark .markdown-body .block-color-gray_background {
  background: var(--card) !important;
}

body.dark .markdown-body .simple-table-header-color {
  background: var(--card) !important;
  color: var(--text) !important;
}

body.dark .markdown-body .selected-value {
  background: var(--card) !important;
  color: var(--text) !important;
}

/* Notion Core Layout Overrides (Fixing Stacked Columns) */
.markdown-body .column-list {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 2rem !important;
  margin: 2rem 0 !important;
}

.markdown-body .column {
  flex: 1 1 min(300px, 100%) !important;
  width: auto !important;
  min-width: 0 !important;
  /* prevent flex blowout */
}

/* Force images inside columns to respond and not blow out layout */
.markdown-body .column img {
  max-width: 100% !important;
  height: auto !important;
  box-sizing: border-box;
}

/* Beautiful Bookmark (Embedded Link) Restyling */
.markdown-body .bookmark {
  display: flex !important;
  flex-direction: row !important;
  border: 1px solid var(--border) !important;
  border-radius: 0.8rem !important;
  overflow: hidden !important;
  text-decoration: none !important;
  margin: 1.5rem 0 !important;
  background: var(--card) !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease !important;
  min-height: 90px;
  align-items: stretch !important;
  padding: 0 !important;
  max-height: none !important;
}

.markdown-body .bookmark:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06) !important;
}

body.dark .markdown-body .bookmark:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4) !important;
}

.markdown-body .bookmark-info {
  flex: 1 1 65% !important;
  padding: 1rem !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  gap: 0.4rem !important;
}

.markdown-body .bookmark-title {
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  margin: 0 !important;
  line-height: 1.3 !important;
  white-space: normal !important;
  height: auto !important;
  overflow: visible !important;
}

.markdown-body .bookmark-description {
  font-size: 0.95rem !important;
  color: var(--muted) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0 !important;
  line-height: 1.5 !important;
  max-height: none !important;
}

.markdown-body .bookmark-href {
  font-size: 0.85rem !important;
  color: var(--accent) !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  margin-top: auto !important;
}

.markdown-body .bookmark-image {
  flex: 0 0 35% !important;
  width: 35% !important;
  min-width: 150px !important;
  object-fit: cover !important;
  border: none !important;
  border-radius: 0 !important;
  border-left: 1px solid var(--border) !important;
  margin: 0 !important;
}

/* Override standard image borders inside bookmarks */
.markdown-body .bookmark img {
  border: none !important;
  margin: 0 !important;
}

@media (max-width: 650px) {
  .markdown-body .bookmark {
    flex-direction: column-reverse !important;
  }

  .markdown-body .bookmark-image {
    width: 100% !important;
    height: 120px !important;
    flex: none !important;
    border-left: none !important;
    border-bottom: 1px solid var(--border) !important;
  }
}