/* ═══════════════════════════════════════════════════════════════════════════
   Incentiv Ghost Theme — screen.css
   Design tokens + layout + prose + components
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. Reset ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* ─── 2. Design Tokens (from styles/tokens.css) ─────────────────────────── */

:root {
  /* Background & Foreground */
  --background: 40 33% 98%;
  --foreground: 0 0% 10%;

  /* Cards & Surfaces */
  --card: 0 0% 100%;
  --card-foreground: 0 0% 10%;
  --surface: 36 26% 94%;
  --surface-elevated: 36 20% 96%;

  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 10%;

  /* Primary — Blue */
  --primary: 214 100% 60%;
  --primary-foreground: 0 0% 100%;
  --primary-hover: 214 100% 50%;

  /* Secondary */
  --secondary: 36 26% 94%;
  --secondary-foreground: 0 0% 10%;

  /* Muted */
  --muted: 36 26% 94%;
  --muted-foreground: 0 0% 40%;

  /* Accent */
  --accent: 217 91% 60%;
  --accent-foreground: 0 0% 100%;

  /* Destructive */
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;

  /* Border & Input */
  --border: 36 15% 88%;
  --input: 36 15% 88%;
  --ring: 214 100% 60%;

  /* Radius Scale */
  --radius-sm: 4px;
  --radius-md: 4px;
  --radius-lg: 4px;
  --radius: 4px;
}

/* ─── 3. Dark Mode Tokens ───────────────────────────────────────────────── */
/* Controlled by html.dark class (set by inline script + toggle button).   */
/* Default is system preference; user override stored in localStorage.      */

html.dark {
  --background: 0 0% 4%;
  --foreground: 40 20% 95%;

  --card: 0 0% 7%;
  --card-foreground: 40 20% 95%;
  --surface: 0 0% 10%;
  --surface-elevated: 0 0% 14%;

  --popover: 0 0% 7%;
  --popover-foreground: 40 20% 95%;

  --primary: 214 100% 65%;
  --primary-foreground: 0 0% 100%;

  --secondary: 0 0% 14%;
  --secondary-foreground: 40 20% 95%;

  --muted: 0 0% 18%;
  --muted-foreground: 0 0% 60%;

  --accent: 217 91% 60%;
  --accent-foreground: 0 0% 100%;

  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;

  --border: 0 0% 18%;
  --input: 0 0% 18%;
  --ring: 214 100% 65%;
}

/* ─── 4. Base ───────────────────────────────────────────────────────────── */

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

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── 5. Layout ─────────────────────────────────────────────────────────── */

.site-wrapper {
  max-width: 1312px;
  margin: 0 auto;
  padding-left: 4rem;   /* px-16 */
  padding-right: 4rem;
}

@media (max-width: 767px) {
  .site-wrapper {
    padding-left: 1.5rem;  /* px-6 */
    padding-right: 1.5rem;
  }
}

.site-main {
  padding-top: 4rem;    /* py-16 */
  padding-bottom: 4rem;
}

/* ─── 6. Navigation ─────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 4rem;  /* h-16 = 64px */
  border-bottom: 1px solid hsl(var(--border));
  background-color: hsl(var(--background) / 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.site-header-inner {
  max-width: 1312px;
  margin: 0 auto;
  padding-left: 4rem;
  padding-right: 4rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 767px) {
  .site-header-inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.site-logo {
  font-weight: 700;
  font-size: 1.125rem;
  color: hsl(var(--foreground));
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-logo:hover { color: hsl(var(--foreground)); }

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

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:hover { color: hsl(var(--foreground)); }

.nav-link-active {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.nav-link-hidden-mobile {
  display: none;
}

@media (min-width: 768px) {
  .nav-link-hidden-mobile {
    display: inline;
  }
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #ffffff;
  background-color: hsl(var(--primary));
  border: none;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color 0.15s ease;
  cursor: pointer;
}

.nav-cta:hover {
  background-color: hsl(var(--primary-hover));
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--muted));
}

/* Moon shown in light mode, sun shown in dark mode */
html:not(.dark) .icon-sun { display: none; }
html.dark .icon-moon { display: none; }

/* ─── 7. Blog Hero ──────────────────────────────────────────────────────── */

.blog-hero {
  margin-bottom: 3rem;  /* mb-12 */
}

.label-uppercase {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: hsl(var(--primary));
  margin-bottom: 0.75rem;
}

.blog-hero h1 {
  font-size: 2.25rem;  /* text-4xl */
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 1rem;
  line-height: 1.2;
}

.blog-hero .hero-subtitle {
  color: hsl(var(--muted-foreground));
  font-size: 1.125rem;
  max-width: 42rem;
}

/* ─── 8. Tag Filter ─────────────────────────────────────────────────────── */

.tag-filter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 0.8125rem;   /* 13px */
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: 100px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.tag-chip:hover {
  border-color: hsl(var(--foreground) / 0.3);
  color: hsl(var(--foreground));
}

.tag-chip-active {
  background-color: hsl(var(--primary));
  color: #ffffff;
  border-color: hsl(var(--primary));
}

.tag-chip-active:hover {
  background-color: hsl(var(--primary-hover));
  border-color: hsl(var(--primary-hover));
  color: #ffffff;
}

/* ─── 9. Posts Grid ─────────────────────────────────────────────────────── */

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.posts-empty {
  color: hsl(var(--muted-foreground));
  margin-top: 3rem;
}

/* ─── 10. Post Card ─────────────────────────────────────────────────────── */

.post-card {
  display: block;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow 0.15s ease;
}

.post-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

.post-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-card-body {
  padding: 1.5rem;  /* p-6 */
}

.post-card-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: hsl(var(--primary));
}

.post-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.375;  /* leading-snug */
  /* line-clamp-2 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}

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

.post-card-excerpt {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.625;  /* leading-relaxed */
  /* line-clamp-3 */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* ─── 11. Post Page ─────────────────────────────────────────────────────── */

.post-wrapper {
  max-width: 48rem;    /* max-w-3xl */
  margin: 0 auto;
}

.post-header {
  margin-bottom: 3rem;  /* mb-12 */
}

.post-header .label-uppercase {
  margin-bottom: 0.75rem;
}

.post-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 1rem;
  line-height: 1.25;
}

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

.feature-image {
  margin-top: 2rem;
  margin-bottom: 0;
}

.feature-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
}

/* ─── 12. Ghost Content Prose ───────────────────────────────────────────── */

.ghost-content {
  color: hsl(var(--foreground));
  line-height: 1.75;
  font-size: 1.0625rem;
  margin-top: 2.5rem;
}

.ghost-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
}

.ghost-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: hsl(var(--foreground));
}

.ghost-content h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
}

.ghost-content p {
  margin-bottom: 1.25rem;
  color: hsl(var(--foreground) / 0.85);
}

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

.ghost-content a:hover {
  color: hsl(var(--primary) / 0.8);
}

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

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

.ghost-content ul li { list-style-type: disc; }
.ghost-content ol li { list-style-type: decimal; }

.ghost-content blockquote {
  border-left: 3px solid hsl(var(--primary));
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

.ghost-content pre {
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.875rem;
}

.ghost-content code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.875em;
  background: hsl(var(--surface));
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

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

.ghost-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
}

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

.ghost-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}

.ghost-content th,
.ghost-content td {
  padding: 0.625rem 0.875rem;
  border: 1px solid hsl(var(--border));
  text-align: left;
}

.ghost-content th {
  background: hsl(var(--surface));
  font-weight: 600;
}

/* ─── 13. Ghost Koenig Card Styles ──────────────────────────────────────── */
/* card_assets: true in package.json auto-injects Ghost's full card CSS.   */
/* These are supplemental overrides to match brand styling.                */

.kg-card {
  margin: 2rem 0;
}

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

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

.kg-width-full {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.kg-callout-card {
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.kg-bookmark-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

/* ─── 14. Contextual CTA ────────────────────────────────────────────────── */

.contextual-cta {
  margin-top: 4rem;  /* mt-16 */
}

.cta-inner {
  padding: 2rem;   /* p-8 */
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--surface));
}

.cta-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: hsl(var(--primary));
  margin-bottom: 0.75rem;
}

.cta-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.cta-description {
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.5rem;
  line-height: 1.625;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.cta-btn-primary {
  color: #ffffff;
  background-color: hsl(var(--primary));
  border: 1px solid transparent;
}

.cta-btn-primary:hover {
  background-color: hsl(var(--primary-hover));
}

.cta-btn-secondary {
  color: hsl(var(--foreground));
  background-color: transparent;
  border: 1px solid hsl(var(--border));
}

.cta-btn-secondary:hover {
  border-color: hsl(var(--foreground));
}

/* ─── 15. Pagination ────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid hsl(var(--border));
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pagination-btn:hover {
  border-color: hsl(var(--foreground) / 0.3);
  background-color: hsl(var(--surface));
}

.pagination-info {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* ─── 16. Error Page ────────────────────────────────────────────────────── */

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

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

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.75rem;
}

.error-description {
  color: hsl(var(--muted-foreground));
  margin-bottom: 2rem;
  max-width: 32rem;
}

.error-back-link {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #ffffff;
  background-color: hsl(var(--primary));
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.error-back-link:hover {
  background-color: hsl(var(--primary-hover));
}

/* ─── 17. Tag Archive Header ────────────────────────────────────────────── */

.tag-archive-hero .label-uppercase {
  text-transform: uppercase;
}
