/*
Theme Name: Substack Style
Theme URI: https://pgc.ai
Author: Gary Liu
Description: A clean, reader-focused WordPress theme inspired by Substack's design with left sidebar.
Version: 2.0
License: GNU General Public License v2 or later
Text Domain: substack-style
*/

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

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Lora', Georgia, serif;
  color: #363737;
  background: #ffffff;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   TWO-COLUMN LAYOUT: LEFT SIDEBAR + CONTENT
   ======================================== */

.site-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ========================================
   LEFT SIDEBAR
   ======================================== */

.left-sidebar {
  background: #fafafa;
  border-right: 1px solid #e8e8e8;
  padding: 32px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  margin-bottom: 16px;
}

.sidebar-logo img,
.sidebar-logo .custom-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-site-name {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: #363737;
  margin-bottom: 6px;
  line-height: 1.3;
}

.sidebar-site-name a {
  color: inherit;
  text-decoration: none;
}

.sidebar-description {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 13px;
  color: #848585;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Author Card */
.sidebar-author-info {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e8e8e8;
}

.sidebar-author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.sidebar-author-info .author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-author-info .author-name {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #363737;
}

.sidebar-author-info .author-bio {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 13px;
  color: #848585;
  line-height: 1.5;
  margin-bottom: 10px;
}

.sidebar-author-links {
  display: flex;
  gap: 14px;
}

.sidebar-author-links a {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 12px;
  color: #363737;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.sidebar-author-links a:hover {
  opacity: 1;
}

.sidebar-author-links svg {
  flex-shrink: 0;
}

/* Subscribe Button */
.sidebar-subscribe {
  margin-bottom: 20px;
}

.subscribe-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: #ff6719;
  color: #fff;
  padding: 10px 16px;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}

.subscribe-btn:hover {
  background: #e85d14;
  color: #fff;
}

/* Sidebar Nav */
.sidebar-nav {
  margin-bottom: 20px;
}

.sidebar-nav a {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 14px;
  color: #363737;
  padding: 7px 0;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s;
}

.sidebar-nav a:hover {
  color: #000;
}

/* Sidebar Widgets */
.sidebar-widgets {
  margin-top: auto;
  padding-top: 16px;
}

.sidebar-widgets .widget {
  margin-bottom: 20px;
}

.sidebar-widgets .widget-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #b6b6b6;
  margin-bottom: 10px;
}

.sidebar-widgets .widget ul {
  list-style: none;
  padding: 0;
}

.sidebar-widgets .widget ul li {
  padding: 4px 0;
}

.sidebar-widgets .widget ul li a {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 13px;
  color: #848585;
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-widgets .widget ul li a:hover {
  color: #363737;
}

/* Sidebar Stats */
.sidebar-stats {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 12px;
  color: #b6b6b6;
  margin-bottom: 20px;
}

.sidebar-stats strong {
  color: #848585;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 11px;
  color: #b6b6b6;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */

.main-content {
  max-width: 680px;
  padding: 0 40px;
  margin: 0;
}

/* ========================================
   POST LIST (Homepage)
   ======================================== */

.post-item {
  padding: 28px 0;
  border-bottom: 1px solid #e8e8e8;
}

.post-item:first-child {
  padding-top: 32px;
}

.post-item-inner {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.post-content {
  flex: 1;
  min-width: 0;
}

.post-category {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ff6719;
  margin-bottom: 6px;
}

.post-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: #363737;
  margin-bottom: 6px;
}

.post-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.post-title a:hover {
  color: #000;
}

.post-subtitle {
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  color: #848585;
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 13px;
  color: #b6b6b6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-meta .author-name {
  color: #848585;
}

.post-meta .dot {
  color: #d8d8d8;
}

.post-meta .post-actions-inline {
  margin-left: auto;
  display: flex;
  gap: 14px;
  align-items: center;
}

.post-meta .post-actions-inline span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #b6b6b6;
  transition: color 0.15s;
}

.post-meta .post-actions-inline span:hover {
  color: #848585;
}

.post-meta .post-actions-inline svg {
  width: 15px;
  height: 15px;
}

.post-thumbnail {
  flex-shrink: 0;
  width: 140px;
  height: 100px;
  border-radius: 4px;
  overflow: hidden;
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================================
   SINGLE POST
   ======================================== */

.single-header {
  padding: 40px 0 0;
}

.single-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.25;
  color: #363737;
  margin-bottom: 10px;
}

.single-subtitle {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  color: #848585;
  line-height: 1.5;
  margin-bottom: 24px;
}

.single-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e8e8e8;
  margin-bottom: 28px;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.meta-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 14px;
}

.meta-text .author-link {
  color: #363737;
  font-weight: 600;
  text-decoration: none;
}

.meta-text .post-date {
  color: #b6b6b6;
  font-size: 13px;
}

/* Language Switch */
.lang-switch {
  margin-left: auto;
}

.lang-switch a,
.lang-switch-bottom a {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 13px;
  color: #ff6719;
  text-decoration: none;
  transition: color 0.15s;
}

.lang-switch a:hover,
.lang-switch-bottom a:hover {
  color: #e85d14;
}

.lang-switch-bottom {
  padding-bottom: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
}

/* Single Content */
.single-content {
  padding: 0 0 48px;
}

.single-content p {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  line-height: 1.8;
  color: #363737;
  margin-bottom: 22px;
}

.single-content h1,
.single-content h2,
.single-content h3,
.single-content h4 {
  font-family: 'Lora', Georgia, serif;
  color: #363737;
  margin-top: 36px;
  margin-bottom: 14px;
}

.single-content h2 { font-size: 24px; font-weight: 700; }
.single-content h3 { font-size: 20px; font-weight: 700; }

.single-content blockquote {
  border-left: 3px solid #363737;
  padding-left: 18px;
  margin: 22px 0;
  font-style: italic;
  color: #848585;
}

.single-content ul,
.single-content ol {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  line-height: 1.8;
  margin-bottom: 22px;
  padding-left: 28px;
}

.single-content li { margin-bottom: 6px; }

.single-content a {
  color: #ff6719;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.single-content a:hover {
  color: #e85d14;
}

.single-content pre {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  padding: 18px;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.6;
}

.single-content code {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: #fafafa;
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid #e8e8e8;
}

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

.single-content img {
  margin: 22px 0;
}

.single-content figure { margin: 22px 0; }

.single-content figcaption {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 13px;
  color: #b6b6b6;
  text-align: center;
  margin-top: 8px;
}

/* Featured Image */
.single-featured-image {
  margin-bottom: 28px;
}

.single-featured-image img {
  width: 100%;
}

/* Post Actions Bar */
.post-actions {
  padding: 16px 0;
  border-top: 1px solid #e8e8e8;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.post-action-item {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 13px;
  color: #b6b6b6;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: color 0.15s;
}

.post-action-item:hover { color: #363737; }
.post-action-item svg { width: 18px; height: 18px; }

/* ========================================
   COMMENTS
   ======================================== */

.comments-section {
  padding: 28px 0 48px;
  border-top: 1px solid #e8e8e8;
}

.comments-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #363737;
}

.comment-list {
  list-style: none;
  padding: 0;
}

.comment {
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}

.comment-author {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #363737;
  margin-bottom: 3px;
}

.comment-meta {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 12px;
  color: #b6b6b6;
  margin-bottom: 8px;
}

.comment-body p {
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  line-height: 1.6;
  color: #363737;
}

.comment-respond { margin-top: 20px; }

.comment-respond .comment-reply-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.comment-respond textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  resize: vertical;
  margin-bottom: 10px;
}

.comment-respond input[type="text"],
.comment-respond input[type="email"],
.comment-respond input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 14px;
  margin-bottom: 8px;
}

.comment-respond .submit {
  background: #ff6719;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.comment-respond .submit:hover { background: #e85d14; }

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
  border-top: 1px solid #e8e8e8;
  padding: 32px 24px;
  text-align: center;
  background: #fafafa;
}

.footer-publication-name {
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  font-weight: 600;
  color: #363737;
  margin-bottom: 6px;
}

.footer-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 12px;
  color: #b6b6b6;
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.footer-links a {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 12px;
  color: #848585;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover { color: #363737; }

/* ========================================
   PAGE
   ======================================== */

.page-header { padding: 40px 0 0; }

.page-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  color: #363737;
  margin-bottom: 28px;
}

.page-content { padding: 0 0 48px; }

/* Archive */
.archive-header { padding: 28px 0 0; }

.archive-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b6b6b6;
  margin-bottom: 0;
}

/* Pagination */
.pagination {
  padding: 28px 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.pagination a,
.pagination span {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  color: #848585;
  text-decoration: none;
}

.pagination a:hover { background: #fafafa; color: #363737; }
.pagination .current { background: #363737; color: #fff; }

/* 404 */
.not-found {
  text-align: center;
  padding: 80px 0;
}

.not-found h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 48px;
  font-weight: 700;
  color: #363737;
  margin-bottom: 12px;
}

.not-found p {
  font-family: 'Lora', Georgia, serif;
  font-size: 17px;
  color: #848585;
}

.not-found a {
  color: #ff6719;
  text-decoration: underline;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 860px) {
  .site-layout {
    grid-template-columns: 1fr;
  }

  .left-sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e8e8e8;
    padding: 12px 20px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 12px;
  }

  .sidebar-logo {
    margin-bottom: 0;
  }

  .sidebar-logo img,
  .sidebar-logo .custom-logo {
    width: 32px;
    height: 32px;
  }

  .sidebar-site-name {
    margin-bottom: 0;
    font-size: 16px;
  }

  .sidebar-description,
  .sidebar-widgets,
  .sidebar-subscribe,
  .sidebar-stats,
  .sidebar-nav {
    display: none;
  }

  .main-content {
    padding: 0 20px;
    max-width: 100%;
  }

  .sidebar-author-row {
    margin-bottom: 4px;
  }
}

@media (max-width: 560px) {
  .post-title { font-size: 18px; }
  .post-subtitle { font-size: 14px; -webkit-line-clamp: 1; }

  .post-thumbnail {
    width: 100px;
    height: 72px;
  }

  .single-title { font-size: 26px; }

  .single-content p,
  .single-content ul,
  .single-content ol {
    font-size: 16px;
  }
}
