/* ══════════════════════════════════════════
   LN Markets Ghost Theme
   Dark theme using woodsmoke/firefly palette
   ══════════════════════════════════════════ */

:root {
  --bg: hsl(85, 3%, 5%);
  --bg-elevated: hsl(85, 3%, 8%);
  --bg-surface: hsl(85, 3%, 11%);
  --bg-input: hsl(85, 3%, 14%);
  --border: hsl(85, 3%, 17%);
  --border-subtle: hsl(85, 3%, 14%);
  --text: hsl(0, 0%, 91%);
  --text-secondary: hsl(0, 0%, 82%);
  --text-muted: hsl(0, 0%, 69%);
  --text-faint: hsl(85, 3%, 44%);
  --accent: hsl(85, 92%, 55%);
  --accent-hover: hsl(86, 96%, 44%);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --container: 1200px;
  --container-narrow: 740px;
  --gap: 24px;
  --radius: 8px;
}

/* ── Reset ── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 62.5%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 1.7rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
}

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

::selection {
  background-color: hsl(85, 92%, 55%, 0.25);
  color: var(--text);
}

/* ── Layout ── */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.container-narrow {
  max-width: var(--container-narrow);
}

.site-main {
  flex: 1;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 2rem;
  border-radius: var(--radius);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  color: var(--bg);
}

.btn-large {
  padding: 1.2rem 3rem;
  font-size: 1.6rem;
}

/* ══════════════════
   Header
   ══════════════════ */

.site-header {
  background-color: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.site-header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.site-logo img {
  max-height: 32px;
  width: auto;
}

.site-logo .site-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.site-logo:hover .site-title {
  color: var(--accent);
}

/* Nav */

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 1.4rem;
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  transition: color 0.15s, background-color 0.15s;
}

.site-nav a:hover {
  color: var(--text);
  background-color: var(--bg-elevated);
}

/* Social links */

.social-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: background-color 0.15s;
}

.social-links a:hover {
  background-color: var(--bg-elevated);
}

.social-links img {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.social-links a:hover img {
  opacity: 1;
}

/* Burger */

.burger-menu {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.burger-menu span {
  width: 22px;
  height: 2px;
  background-color: var(--text-secondary);
  border-radius: 1px;
  transition: background-color 0.15s;
}

.burger-menu:hover span {
  background-color: var(--text);
}

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

  .social-links,
  .site-header-actions {
    display: none;
  }

  .burger-menu {
    display: flex;
  }
}

/* ══════════════════
   Hero
   ══════════════════ */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background-size: cover;
  background-position: center;
  margin-bottom: 48px;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    hsl(85, 3%, 5%, 0.6) 0%,
    hsl(85, 3%, 5%, 0.85) 100%
  );
}

.hero-content {
  position: relative;
  text-align: center;
  padding: 48px var(--gap);
}

.hero-content h1 {
  font-size: 4.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.hero-content p {
  font-size: 2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ══════════════════
   Post Feed
   ══════════════════ */

.post-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--gap);
  padding: 48px 0;
}

/* Post Card */

.post-card {
  border-radius: var(--radius);
  overflow: hidden;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.2s, transform 0.2s;
}

.post-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
}

.post-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
}

.post-card-link:hover {
  color: inherit;
}

.post-card-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

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

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

.post-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-card-tag {
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 8px;
}

.post-card-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
  transition: color 0.15s;
}

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

.post-card-excerpt {
  font-size: 1.5rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 16px;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.3rem;
  color: var(--text-faint);
}

/* ══════════════════
   Article
   ══════════════════ */

.article-header {
  padding: 64px 0 32px;
}

.article-tag {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 12px;
}

.article-title {
  font-size: 4.2rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 16px;
}

.article-excerpt {
  font-size: 2rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 1.4rem;
  color: var(--text-faint);
}

.article-author {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.article-author:hover {
  color: var(--accent);
}

.article-author-image {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.article-date,
.article-reading-time {
  color: var(--text-faint);
}

/* Feature image */

.article-image {
  margin: 32px auto 48px;
  max-width: 1400px;
  border-radius: var(--radius);
  overflow: hidden;
}

.article-image img {
  width: 100%;
}

.article-image figcaption {
  text-align: center;
  font-size: 1.3rem;
  color: var(--text-faint);
  padding: 12px var(--gap);
}

/* ══════════════════
   Article Content (gh-content)
   ══════════════════ */

.article-content {
  padding-bottom: 64px;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  color: var(--text);
  margin: 48px 0 16px;
  line-height: 1.3;
}

.article-content h1 { font-size: 3.6rem; }
.article-content h2 { font-size: 2.8rem; }
.article-content h3 { font-size: 2.2rem; }
.article-content h4 { font-size: 1.8rem; }

.article-content p {
  margin-bottom: 24px;
  color: var(--text-secondary);
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-content a:hover {
  color: var(--accent-hover);
}

.article-content strong {
  color: var(--text);
  font-weight: 600;
}

/* Lists */

.article-content ul,
.article-content ol {
  margin-bottom: 24px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.article-content li {
  margin-bottom: 8px;
}

.article-content li::marker {
  color: var(--text-faint);
}

/* Blockquote */

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 20px;
  margin: 32px 0;
  font-style: italic;
  color: var(--text-muted);
}

/* Code */

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}

.article-content pre {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 32px 0;
  overflow-x: auto;
}

.article-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 1.4rem;
  line-height: 1.6;
}

/* Images */

.article-content img {
  border-radius: var(--radius);
  margin: 32px auto;
}

.article-content figcaption {
  text-align: center;
  font-size: 1.3rem;
  color: var(--text-faint);
  margin-top: 8px;
}

/* Horizontal rule */

.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* Tables */

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
}

.article-content th,
.article-content td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-content th {
  background-color: var(--bg-surface);
  color: var(--text);
  font-weight: 600;
}

.article-content td {
  color: var(--text-secondary);
}

/* Ghost cards (bookmark, callout, etc.) */

.article-content .kg-card {
  margin: 32px 0;
}

.article-content .kg-bookmark-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.article-content .kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: inherit;
}

.article-content .kg-bookmark-content {
  flex: 1;
  padding: 20px;
}

.article-content .kg-bookmark-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.article-content .kg-bookmark-description {
  font-size: 1.4rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.article-content .kg-bookmark-metadata {
  font-size: 1.3rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-content .kg-bookmark-icon {
  width: 20px;
  height: 20px;
  margin: 0;
}

.article-content .kg-bookmark-thumbnail {
  width: 200px;
  min-height: 100%;
}

.article-content .kg-bookmark-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
}

/* Callout card */

.article-content .kg-callout-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.article-content .kg-callout-text {
  color: var(--text-secondary);
}

/* Width overrides for Ghost cards */

.article-content .kg-width-wide {
  margin-left: calc(-1 * (min(calc((100vw - var(--container-narrow)) / 2 - var(--gap)), 200px)));
  margin-right: calc(-1 * (min(calc((100vw - var(--container-narrow)) / 2 - var(--gap)), 200px)));
}

.article-content .kg-width-full {
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  border-radius: 0;
}

/* ══════════════════
   Subscribe CTA
   ══════════════════ */

.subscribe-cta {
  text-align: center;
  padding: 64px 0;
  border-top: 1px solid var(--border-subtle);
}

.subscribe-cta h2 {
  font-size: 2.4rem;
  color: var(--text);
  margin-bottom: 8px;
}

.subscribe-cta p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ══════════════════
   Related Posts
   ══════════════════ */

.related-posts {
  padding: 48px 0 64px;
  border-top: 1px solid var(--border-subtle);
}

.related-posts-title {
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 24px;
}

/* ══════════════════
   Tag & Author Headers
   ══════════════════ */

.tag-header,
.author-header {
  text-align: center;
  padding: 64px 0 0;
}

.tag-header h1,
.author-header h1 {
  font-size: 3.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.tag-description,
.author-bio {
  font-size: 1.8rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
}

.author-location {
  font-size: 1.4rem;
  color: var(--text-faint);
  display: block;
  margin-top: 8px;
}

/* ══════════════════
   Pagination
   ══════════════════ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 0 64px;
  font-size: 1.4rem;
  color: var(--text-faint);
}

.pagination a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.8rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}

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

/* ══════════════════
   Footer
   ══════════════════ */

.site-footer {
  background-color: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.site-footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 40px var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer-nav ul {
  list-style: none;
  display: flex;
  gap: 16px;
}

.site-footer-nav a {
  color: var(--text-muted);
  font-size: 1.4rem;
}

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

.site-footer-copy {
  font-size: 1.3rem;
  color: var(--text-faint);
}

/* ══════════════════
   Error Page
   ══════════════════ */

.error-page {
  text-align: center;
  padding: 120px 0;
}

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

.error-message {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ══════════════════
   Ghost Portal Overrides
   ══════════════════ */

.gh-portal-triggerbtn-iframe {
  color-scheme: dark;
}

/* ══════════════════
   Responsive
   ══════════════════ */

@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 3.2rem;
  }

  .hero-content p {
    font-size: 1.7rem;
  }

  .article-title {
    font-size: 3rem;
  }

  .article-excerpt {
    font-size: 1.7rem;
  }

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

  .article-content .kg-bookmark-container {
    flex-direction: column;
  }

  .article-content .kg-bookmark-thumbnail {
    width: 100%;
    min-height: 200px;
  }

  .site-footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  :root {
    --gap: 16px;
  }

  .hero-content h1 {
    font-size: 2.6rem;
  }

  .article-title {
    font-size: 2.6rem;
  }

  .article-header {
    padding: 40px 0 24px;
  }
}
