/* ============================================
   TUTON BLOG THEME
   Matches tuton.io design system
   ============================================ */

/* --- Variables --- */
:root {
  --color-primary: #2563EB;
  --color-primary-hover: #1d4ed8;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-bg: #ffffff;
  --color-bg-subtle: #f8faff;
  --color-border: #e2e8f0;
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 12px;
  --nav-height: 64px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* --- Container --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header / Nav --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  height: var(--nav-height);
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.logo-wordmark {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--color-text); }
.btn-primary {
  display: inline-flex;
  align-items: center;
  background: var(--color-primary);
  color: white !important;
  padding: 8px 20px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.btn-primary:hover { background: var(--color-primary-hover); }

/* --- Blog Header --- */
.blog-header {
  background: var(--color-bg-subtle);
  padding: 80px 0 72px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}
.blog-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: 12px;
}
.blog-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.15;
  margin-bottom: 16px;
}
.blog-subtitle {
  font-size: 18px;
  color: var(--color-text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* --- Post Grid --- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
  padding: 56px 0 80px;
}
.post-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: box-shadow 0.2s, transform 0.2s;
}
.post-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.post-card-image-link { display: block; }
.post-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.post-card-content { padding: 24px; }
.post-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  text-decoration: none;
  margin-bottom: 8px;
}
.post-card-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 10px;
}
.post-card-title a {
  text-decoration: none;
  color: var(--color-text);
  transition: color 0.15s;
}
.post-card-title a:hover { color: var(--color-primary); }
.post-card-excerpt {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
}
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* --- Single Post --- */
.post-hero {
  background: var(--color-bg-subtle);
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--color-border);
}
.post-column {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 24px;
}
.post-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-text);
  margin: 10px 0 16px;
}
.post-excerpt {
  font-size: 20px;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}
.post-byline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
  color: var(--color-text-muted);
}
.byline-sep { opacity: 0.4; }
.post-feature-image { padding: 48px 0 0; }
.post-feature-image img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--radius);
}
.post-content { padding: 56px 0 0; }
.post-feature-image { margin: 0 auto 48px; max-width: 1100px; padding: 0 24px; }
.post-feature-image img { width: 100%; border-radius: 12px; display: block; }
.post-footer { padding: 48px 0 80px; }
.back-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* --- Post Body (Prose) --- */
.gh-content {
  font-size: 18px;
  line-height: 1.8;
  color: var(--color-text);
}
.gh-content h1, .gh-content h2, .gh-content h3,
.gh-content h4, .gh-content h5, .gh-content h6 {
  font-weight: 700;
  line-height: 1.25;
  margin: 2em 0 0.75em;
  color: var(--color-text);
}
.gh-content h1 { font-size: 2em; }
.gh-content h2 { font-size: 1.5em; }
.gh-content h3 { font-size: 1.25em; }
.gh-content p { margin: 0 0 1.5em; }
.gh-content a { color: var(--color-primary); text-decoration: underline; }
.gh-content a:hover { color: var(--color-primary-hover); }
.gh-content ul, .gh-content ol { padding-left: 1.5em; margin: 0 0 1.5em; }
.gh-content li { margin-bottom: 0.5em; }
.gh-content blockquote {
  border-left: 4px solid var(--color-primary);
  margin: 2em 0;
  padding: 1em 1.5em;
  background: var(--color-bg-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1.1em;
  color: var(--color-text-muted);
}
.gh-content code {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.875em;
  font-family: 'Geist Mono', 'SF Mono', monospace;
}
.gh-content pre {
  background: var(--color-text);
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 24px;
  overflow-x: auto;
  margin: 0 0 1.5em;
}
.gh-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 14px;
}
.gh-content img {
  border-radius: var(--radius);
  margin: 2em 0;
  width: 100%;
}
.gh-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 3em 0;
}
.gh-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 15px;
}
.gh-content th, .gh-content td {
  border: 1px solid var(--color-border);
  padding: 10px 14px;
  text-align: left;
}
.gh-content th {
  background: var(--color-bg-subtle);
  font-weight: 600;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 0 0 80px;
  font-size: 14px;
  color: var(--color-text-muted);
}
.pagination a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}
.pagination a:hover { text-decoration: underline; }

/* --- Page --- */
.page-content {
  padding: 72px 0 80px;
  max-width: 760px;
}
.page-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 40px;
  line-height: 1.15;
}

/* --- Error Page --- */
.error-page {
  text-align: center;
  padding: 120px 24px;
}
.error-code {
  font-size: 80px;
  font-weight: 700;
  color: var(--color-border);
  line-height: 1;
  margin-bottom: 16px;
}
.error-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}
.error-message {
  color: var(--color-text-muted);
  margin-bottom: 32px;
}

/* --- Footer --- */
.site-footer {
  background: var(--color-text);
  color: white;
  padding: 56px 0;
  text-align: center;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-bottom: 12px;
}
.footer-logo .logo-icon { background: var(--color-primary); }
.footer-logo .logo-wordmark { color: white; }
.footer-tagline {
  color: rgba(255,255,255,0.55);
  font-size: 14px;
  margin-bottom: 20px;
}
.footer-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.footer-nav a {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-nav a:hover { color: white; }
.footer-copy {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .post-grid { grid-template-columns: 1fr; gap: 20px; padding: 40px 0 60px; }
  .blog-header { padding: 56px 0 48px; }
  .blog-subtitle { font-size: 16px; }
  .post-hero { padding: 48px 0 40px; }
  .post-content { padding: 40px 0 0; }
  .gh-content { font-size: 17px; }
  .post-footer { padding: 32px 0 60px; }
}

/* ============================================
   KOENIG EDITOR — Required classes
   ============================================ */

.kg-width-wide {
  margin-left: calc(50% - 50vw + 2rem);
  margin-right: calc(50% - 50vw + 2rem);
  max-width: 1200px;
}
.kg-width-full {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: 100vw;
}
.kg-image { width: 100%; }
.kg-image-card { margin: 2em 0; }
.kg-image-card img { border-radius: var(--radius); }
.kg-gallery-container { display: flex; flex-direction: column; gap: 4px; margin: 2em 0; }
.kg-gallery-row { display: flex; gap: 4px; }
.kg-gallery-image { flex: 1; min-width: 0; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.kg-video-card { margin: 2em 0; }
.kg-video-card video { width: 100%; border-radius: var(--radius); }
.kg-embed-card { margin: 2em 0; }
.kg-embed-card iframe { width: 100%; border-radius: var(--radius); border: none; }
.kg-bookmark-card { margin: 2em 0; }
.kg-bookmark-container {
  display: flex; border: 1px solid var(--color-border);
  border-radius: var(--radius); overflow: hidden; text-decoration: none;
  color: var(--color-text); transition: box-shadow 0.15s;
}
.kg-bookmark-container:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.kg-bookmark-content { padding: 20px; flex: 1; }
.kg-bookmark-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.kg-bookmark-description { font-size: 13px; color: var(--color-text-muted); line-height: 1.5; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--color-text-muted); }
.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: 16px; padding: 20px 24px;
  background: var(--color-bg-subtle); border-radius: var(--radius);
  border-left: 4px solid var(--color-primary); margin: 2em 0;
}
.kg-callout-emoji { font-size: 24px; }
.kg-callout-text { font-size: 16px; line-height: 1.6; }
.kg-toggle-card { border: 1px solid var(--color-border); border-radius: var(--radius); margin: 2em 0; overflow: hidden; }
.kg-toggle-heading { padding: 16px 20px; font-weight: 600; cursor: pointer; }
.kg-toggle-content { padding: 0 20px 16px; }
.kg-product-card { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 24px; margin: 2em 0; }
.kg-audio-card { margin: 2em 0; }
.kg-file-card { margin: 2em 0; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px 20px; }
.kg-header-card { text-align: center; padding: 80px 24px; background: var(--color-bg-subtle); border-radius: var(--radius); margin: 2em 0; }
