/* Scopewell AI Ghost Theme - Matching Vite design system */

@import url('https://cdn.jsdelivr.net/npm/geist@1.3.0/dist/fonts/geist-sans/index.css');
@import url('https://cdn.jsdelivr.net/npm/geist@1.3.0/dist/fonts/geist-mono/index.css');

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  --background: hsl(0, 0%, 100%);
  --foreground: hsl(220, 15%, 10%);
  --primary: hsl(220, 90%, 50%);
  --primary-foreground: hsl(0, 0%, 100%);
  --muted: hsl(220, 10%, 96%);
  --muted-foreground: hsl(220, 10%, 45%);
  --border: hsl(220, 10%, 90%);
  --border-subtle: hsl(220, 10%, 92%);
  --text-hero: hsl(220, 15%, 8%);
  --surface-elevated: hsl(220, 10%, 98%);
  --radius: 0px;
  --font-sans: 'Geist Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Geist Mono', 'Courier New', monospace;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--text-hero);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p { line-height: 1.75; color: var(--foreground); }

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-hero);
  text-decoration: none;
}

.site-logo img {
  width: 2rem;
  height: 2rem;
}

.site-logo .dot { color: var(--primary); }

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

.site-nav a {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s;
  letter-spacing: 0.01em;
}

.site-nav a:hover { color: var(--foreground); }

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--foreground);
  color: var(--background);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--foreground);
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.header-cta:hover {
  background: var(--background);
  color: var(--foreground);
  border-color: var(--foreground);
  text-decoration: none;
}

/* ============================================
   MAIN CONTENT OFFSET
   ============================================ */
.site-content { padding-top: 4rem; overflow-x: hidden; }

/* ============================================
   BLOG INDEX - HERO
   ============================================ */
.blog-hero {
  border-bottom: 1px solid var(--border);
  padding: 5rem 0 4rem;
}

.blog-hero-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

.blog-hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  margin-bottom: 1rem;
  max-width: 600px;
}

.blog-hero p {
  color: var(--muted-foreground);
  font-size: 1.125rem;
  max-width: 480px;
  font-weight: 300;
}

.blog-hero p strong {
  color: var(--foreground);
  font-weight: 500;
}

/* ============================================
   POST GRID
   ============================================ */
.post-feed {
  padding: 4rem 0;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1px;
  background: var(--border);
  overflow-x: hidden;
}

/* Featured post - full width */
.post-grid .post-card:first-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.post-grid .post-card:first-child .post-card-image {
  height: 100%;
  min-height: 300px;
}

/* ============================================
   POST CARD
   ============================================ */
.post-card {
  background: var(--background);
  display: flex;
  flex-direction: column;
  transition: background 0.2s;
}

.post-card:hover { background: var(--surface-elevated); }

.post-card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card-image img { transform: scale(1.03); }

.post-card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-tag {
  display: inline-block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.post-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-hero);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.post-card-title a {
  color: inherit;
  text-decoration: none;
}

.post-card-title a:hover { color: var(--primary); }

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.post-card-author-image {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0;
  object-fit: cover;
}

/* ============================================
   ARTICLE PAGE
   ============================================ */
.article-header {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}

.article-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.article-tag {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.article-tag:hover { text-decoration: underline; }

.article-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  max-width: 800px;
}

.article-excerpt {
  font-size: 1.125rem;
  color: var(--muted-foreground);
  max-width: 640px;
  line-height: 1.65;
  font-weight: 300;
  margin-bottom: 2rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.article-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-author-image {
  width: 2rem;
  height: 2rem;
  border-radius: 0;
  object-fit: cover;
  border: 1px solid var(--border);
}

.article-author-name {
  font-weight: 600;
  color: var(--foreground);
}

.article-meta-divider { color: var(--border); }

.article-feature-image-wrap {
  max-width: 900px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
}

.article-feature-image {
  display: block;
  width: 100%;
  max-height: 560px;
  object-fit: cover;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 900px) {
  .article-feature-image-wrap {
    padding: 0;
  }
}

/* ============================================
   ARTICLE BODY
   ============================================ */
.article-body {
  padding: 3rem 0 4rem;
}

.gh-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--foreground);
}

.gh-content > * + * { margin-top: 1.5rem; }

.gh-content h2 {
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.gh-content h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.gh-content p { margin-bottom: 1.5rem; }

.gh-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gh-content strong { font-weight: 700; }
.gh-content em { font-style: italic; }

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

.gh-content li { margin-bottom: 0.5rem; }

.gh-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: var(--surface-elevated);
  font-style: italic;
  color: var(--muted-foreground);
}

.gh-content blockquote p { margin: 0; }

.gh-content pre {
  background: var(--foreground);
  color: var(--background);
  padding: 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 2rem 0;
  border: 1px solid var(--border);
}

.gh-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--muted);
  padding: 0.125em 0.375em;
  border: 1px solid var(--border);
}

.gh-content pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
}

.gh-content img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  margin: 2rem 0;
}

.gh-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

.gh-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
}

.gh-content th {
  background: var(--muted);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
}

.gh-content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
}

.gh-content tr:nth-child(even) td { background: var(--surface-elevated); }

/* ============================================
   ARTICLE FOOTER / RELATED
   ============================================ */
.article-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
}

.article-author-card {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 2rem;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
}

.article-author-card-image {
  width: 4rem;
  height: 4rem;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.article-author-card-name {
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.article-author-card-bio {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.6;
}

/* Related posts */
.related-posts { padding: 3rem 0; border-top: 1px solid var(--border); }

.related-posts-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
  margin-bottom: 2rem;
}

.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--border);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--foreground);
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.pagination a:hover {
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
}

.pagination .active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  margin-top: 4rem;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-logo {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-hero);
  text-decoration: none;
}

.footer-logo .dot { color: var(--primary); }

.footer-nav {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-nav a {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-nav a:hover { color: var(--foreground); }

.footer-copy {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ============================================
   CTA BANNER
   ============================================ */
.cta-banner {
  background: var(--foreground);
  color: var(--background);
  padding: 3rem 0;
  margin: 4rem 0 0;
}

.cta-banner .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.cta-banner h2 {
  color: var(--background);
  font-size: 1.5rem;
  margin: 0;
}

.cta-banner p {
  color: rgba(255,255,255,0.6);
  font-size: 0.9375rem;
  margin-top: 0.25rem;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--primary);
  transition: all 0.2s;
  white-space: nowrap;
}

.cta-button:hover {
  background: transparent;
  color: var(--primary);
  text-decoration: none;
}

/* ============================================
   TAG PAGE
   ============================================ */
.tag-header {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}

.tag-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}

.tag-name {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.75rem;
}

.tag-description {
  color: var(--muted-foreground);
  font-size: 1rem;
  max-width: 480px;
}

/* ============================================
   404 PAGE
   ============================================ */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 4rem 1.5rem;
}

.error-code {
  font-size: 6rem;
  font-weight: 700;
  color: var(--border);
  line-height: 1;
  margin-bottom: 1rem;
}

.error-message {
  font-size: 1.25rem;
  color: var(--muted-foreground);
  margin-bottom: 2rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .site-nav { display: none; }

  .post-grid .post-card:first-child {
    grid-template-columns: 1fr;
    grid-column: 1 / -1;
  }

  .post-grid .post-card:first-child .post-card-image {
    height: auto;
    aspect-ratio: 16/9;
    width: 100%;
    max-width: 100%;
  }

  .post-card-image {
    width: 100%;
    max-width: 100%;
  }

  .post-card-image img {
    width: 100%;
    max-width: 100%;
  }

  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .cta-banner .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-author-card {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .post-grid {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
  }

  .post-card {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .post-card-image,
  .post-card-image img {
    width: 100%;
    max-width: 100%;
  }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }

/* ============================================
   GHOST KOENIG EDITOR CARD WIDTHS
   ============================================ */
.kg-width-wide {
  margin-left: calc(50% - 50vw + 1.5rem);
  margin-right: calc(50% - 50vw + 1.5rem);
  max-width: none;
}

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

.kg-image { max-width: 100%; }
.kg-image-card { margin: 2rem 0; }
.kg-image-card img { margin: 0 auto; }

.kg-gallery-container { display: flex; flex-direction: column; }
.kg-gallery-row { display: flex; flex-direction: row; justify-content: center; gap: 0.5rem; margin: 0.5rem 0; }
.kg-gallery-image img { display: block; width: 100%; height: 100%; object-fit: cover; }

.kg-embed-card { display: flex; flex-direction: column; align-items: center; margin: 2rem 0; }
.kg-embed-card iframe { max-width: 100%; }

.kg-bookmark-card { border: 1px solid var(--border); margin: 2rem 0; }
.kg-bookmark-container { display: flex; text-decoration: none; color: inherit; }
.kg-bookmark-content { padding: 1rem; flex: 1; }
.kg-bookmark-title { font-weight: 700; margin-bottom: 0.25rem; }
.kg-bookmark-description { font-size: 0.875rem; color: var(--muted-foreground); }
.kg-bookmark-thumbnail { width: 160px; flex-shrink: 0; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.kg-callout-card { display: flex; gap: 1rem; padding: 1.25rem; background: var(--surface-elevated); border: 1px solid var(--border); margin: 2rem 0; }
.kg-callout-emoji { font-size: 1.5rem; }

.kg-toggle-card { border: 1px solid var(--border); margin: 2rem 0; }
.kg-toggle-heading { display: flex; justify-content: space-between; padding: 1rem; cursor: pointer; font-weight: 600; }
.kg-toggle-content { padding: 1rem; border-top: 1px solid var(--border); }

.kg-button-card { display: flex; justify-content: center; margin: 2rem 0; }
.kg-btn { display: inline-flex; padding: 0.75rem 1.5rem; background: var(--primary); color: white; font-weight: 600; text-decoration: none; }


/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--background);
  border: 1px solid var(--border);
  max-width: 480px;
  width: 100%;
  padding: 2.5rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.25rem;
}

.modal-close:hover { color: var(--foreground); }

.modal-box h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.modal-box p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

.modal-form input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  outline: none;
  box-sizing: border-box;
}

.modal-form input:focus {
  border-color: var(--foreground);
}

.modal-submit {
  padding: 0.75rem 1.5rem;
  background: var(--foreground);
  color: var(--background);
  border: 1px solid var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.modal-submit:hover {
  background: var(--background);
  color: var(--foreground);
}

.form-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

.modal-success {
  text-align: center;
  padding: 2rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}
