/* ============================================
   Osaka Jade Theme — screen.css
   ============================================ */

/* --- Custom Properties --- */
:root {
  --jade: #2D6A4F;
  --jade-light: #40916C;
  --midnight: #1B1F3B;
  --black: #0A0A0A;
  --bg: #FAFAF8;
  --bg-alt: #F0F0EC;
  --text: #1A1A1A;
  --text-muted: #6B6B6B;
  --border: #E0E0DC;
  --content-width: 680px;
  --wide-width: 1200px;
  --nav-height: 64px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
}

/* Dark mode via custom setting */
.dark-mode {
  --bg: #0F1117;
  --bg-alt: #1A1D2B;
  --text: #E0E0E0;
  --text-muted: #9A9A9A;
  --border: #2A2D3A;
  --jade-light: #52B788;
}

/* Auto mode follows system preference */
@media (prefers-color-scheme: dark) {
  .auto-mode {
    --bg: #0F1117;
    --bg-alt: #1A1D2B;
    --text: #E0E0E0;
    --text-muted: #9A9A9A;
    --border: #2A2D3A;
    --jade-light: #52B788;
  }
}

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

html { font-size: 18px; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--jade);
  text-decoration: none;
}
a:hover { color: var(--jade-light); }

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

/* --- Ghost Editor Width Classes (required) --- */
.kg-width-wide {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.kg-width-full {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.kg-width-wide img,
.kg-width-full img {
  max-width: 100%;
}

/* --- Site Header / Navigation --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.site-header-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-logo img { height: 32px; width: auto; }
.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.site-nav { display: flex; gap: 1.5rem; }
.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.nav-link:hover { color: var(--jade); }

/* --- Hero Section (Homepage) --- */
.hero-section {
  max-width: var(--wide-width);
  margin: 3rem auto 2rem;
  padding: 0 2rem;
}

.hero-post {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-image img { border-radius: 8px; }

.hero-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--jade);
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.hero-title a { color: var(--text); }
.hero-title a:hover { color: var(--jade); }

.hero-excerpt {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.hero-meta { color: var(--text-muted); font-size: 0.875rem; }

/* --- Pillar Grid (Homepage) --- */
.pillar-grid {
  max-width: var(--wide-width);
  margin: 0 auto 4rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.pillar-heading {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 3px solid var(--jade);
}
.pillar-heading a { color: var(--text); }
.pillar-heading a:hover { color: var(--jade); }

/* --- Post Card --- */
.post-card { margin-bottom: 2rem; }
.post-card-link { display: block; color: inherit; }
.post-card-link:hover .post-card-title { color: var(--jade); }

.post-card-image { margin-bottom: 0.75rem; border-radius: 6px; overflow: hidden; }

.post-card-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--jade);
}

.post-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0.25rem 0 0.5rem;
  color: var(--text);
  transition: color 0.15s;
}

.post-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.post-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.75rem;
}

/* --- Section Page --- */
.section-header {
  max-width: var(--content-width);
  margin: 3rem auto 2rem;
  padding: 0 2rem;
  text-align: center;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.section-description {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.post-feed {
  max-width: var(--wide-width);
  margin: 0 auto 3rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

/* --- Article Page --- */
.article-header {
  max-width: var(--content-width);
  margin: 3rem auto 2rem;
  padding: 0 2rem;
  text-align: center;
}

.article-meta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.article-tag {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--jade);
}

.article-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.article-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.article-feature-image {
  max-width: 960px;
  margin: 0 auto 2.5rem;
  padding: 0 2rem;
}
.article-feature-image img { border-radius: 8px; }
.article-feature-image figcaption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* --- Article Body (Ghost content) --- */
.article-body {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
}

.article-body p { margin-bottom: 1.25rem; }

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

.article-body li { margin-bottom: 0.5rem; }

.article-body blockquote {
  border-left: 3px solid var(--jade);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.article-body figure {
  margin: 2rem 0;
}
.article-body figcaption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Code blocks — midnight blue background */
.article-body pre {
  background: var(--midnight);
  color: #E0E0E0;
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* Inline code */
.article-body p code, .article-body li code {
  background: var(--bg-alt);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.85em;
}

/* --- Article Footer / Tags --- */
.article-footer {
  max-width: var(--content-width);
  margin: 2.5rem auto 0;
  padding: 2rem 2rem 0;
  border-top: 1px solid var(--border);
}

.article-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-pill {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-weight: 500;
}
.tag-pill:hover { background: var(--jade); color: #fff; }

/* --- Tag index (/tags/) --- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 3rem;
}
.tag-cloud .tag-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.9rem;
  padding: 0.4rem 0.9rem;
}
.tag-count {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
}

/* --- Related Posts --- */
.related-posts {
  max-width: var(--wide-width);
  margin: 3rem auto;
  padding: 0 2rem;
}

.related-heading {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--jade);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

/* --- Static Page --- */
.page-header {
  max-width: var(--content-width);
  margin: 3rem auto 2rem;
  padding: 0 2rem;
  text-align: center;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 800;
}

.page-body {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* Inherit article-body styles for page content */
.page-body h2, .page-body h3, .page-body p,
.page-body ul, .page-body ol, .page-body blockquote {
  /* same as article-body */
}

.page-body p { margin-bottom: 1.25rem; }

/* --- Pagination --- */
.pagination {
  max-width: var(--wide-width);
  margin: 2rem auto 4rem;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.pagination-prev, .pagination-next {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--jade);
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 2rem;
}

.site-footer-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-right { display: flex; gap: 1.5rem; }
.footer-right a { color: var(--text-muted); }
.footer-right a:hover { color: var(--jade); }

/* --- Responsive --- */
@media (max-width: 768px) {
  html { font-size: 16px; }

  .hero-post { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-title { font-size: 1.75rem; }
  .article-title { font-size: 1.75rem; }

  .pillar-grid,
  .post-feed,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .site-nav { gap: 1rem; }
  .nav-link { font-size: 0.75rem; }

  .site-header-inner,
  .hero-section,
  .pillar-grid,
  .section-header,
  .article-header,
  .article-body,
  .article-footer,
  .post-feed,
  .related-posts,
  .page-header,
  .page-body,
  .pagination,
  .site-footer-inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.pillar-empty {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}
