/* ==========================================================================
   Leadhub Ghost Theme
   Design inspired by leadhub.co — Work Sans + PolySans, brand orange accent
   ========================================================================== */

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

:root {
  --color-bg: #ffffff;
  --color-bg-card: #fafafa;
  --color-bg-sidebar: #f5f5f5;
  --color-text: #1d1816;
  --color-text-secondary: #4f4f4f;
  --color-text-muted: #6d6d6d;
  --color-accent: #fe4011;
  --color-accent-hover: #c61708;
  --color-accent-light: #ff5d2a;
  --color-green: #07c276;
  --color-border: #e8e8e8;
  --color-link: #fe4011;
  --color-footer-bg: #1d1816;
  --color-footer-text: #999;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --content-width: 1080px;
  --content-narrow: 780px;
  --radius: 0.625rem;
  --radius-lg: 1rem;
  --radius-full: 60px;
}

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

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

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s;
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-text);
  font-weight: 600;
  line-height: 1.3;
  scroll-margin-top: 80px;
}

/* ---------- Layout ---------- */
.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-content {
  flex: 1;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 40px 20px;
}

.site-content--with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  width: 100%;
}

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

.site-header__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.site-header__logo img {
  height: 36px;
  width: auto;
}

.site-header__logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

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

.site-nav a {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

.site-nav__search {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

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

.site-nav__cta {
  background: #FF5D2A;
  color: #fff !important;
  padding: 9px 22px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.2s !important;
}

.site-nav__cta:hover {
  background: #F54A00;
  color: #fff !important;
}

/* Language switcher dropdown */
.lang-switcher {
  position: relative;
}

.lang-switcher__toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 0.2s;
}

.lang-switcher__toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.lang-switcher__toggle svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s;
}

.lang-switcher.is-open .lang-switcher__toggle svg {
  transform: rotate(180deg);
}

.lang-switcher__dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  min-width: 120px;
  overflow: hidden;
  z-index: 200;
}

.lang-switcher.is-open .lang-switcher__dropdown {
  display: block;
}

.lang-switcher__dropdown a {
  display: block;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  transition: background 0.15s;
}

.lang-switcher__dropdown a:hover {
  background: var(--color-bg-card);
  color: var(--color-accent);
}

.lang-switcher__dropdown a.is-active {
  color: var(--color-accent);
  font-weight: 600;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 101;
  cursor: pointer;
}

/* ---------- Post Grid (Homepage) ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.post-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--color-border);
  position: relative;
  cursor: pointer;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.post-card__link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.post-card__tag {
  position: relative;
  z-index: 2;
}

.post-card__image-link {
  display: block;
  position: relative;
  padding-top: 66.67%;
  overflow: hidden;
}

.post-card__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

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

.post-card__content {
  padding: 20px;
}

.post-card__tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-accent);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.post-card__title {
  font-size: 1.1rem;
  margin-bottom: 10px;
  line-height: 1.4;
  font-weight: 600;
}

.post-card__title a {
  color: var(--color-text);
}

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

.post-card__excerpt {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Featured post (first on homepage) */
.post-card--featured {
  grid-column: 1 / -1;
}

.post-card--featured .post-card__title {
  font-size: 1.5rem;
}

/* Post tags */
.post-tags {
  margin: 40px 0 0;
}

.post-tags__tag {
  display: inline-block;
  background: var(--color-bg-card);
  color: var(--color-text-muted);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin: 4px 4px 4px 0;
}

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

/* ---------- Pagination / Load More ---------- */
.pagination {
  text-align: center;
  padding: 40px 0;
}

.pagination a,
.load-more-btn {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  padding: 12px 32px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.pagination a:hover,
.load-more-btn:hover {
  background: var(--color-accent-hover);
  color: #fff;
}

.pagination .page-number {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 16px;
}

/* ---------- Single Post ---------- */
.post-header {
  max-width: var(--content-narrow);
  margin: 0 auto 30px;
}

.post-header__tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-accent);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.post-header__title {
  font-size: 2.2rem;
  line-height: 1.25;
  margin-bottom: 16px;
  font-weight: 700;
}

.post-header__meta {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.post-header__meta a {
  color: var(--color-text-muted);
}

.post-feature-image {
  max-width: var(--content-width);
  margin: 0 auto 40px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.post-content {
  max-width: var(--content-narrow);
  margin: 0 auto;
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--color-text-secondary);
}

.post-content h2 {
  font-size: 1.75rem;
  margin: 48px 0 16px;
  color: var(--color-text);
}

.post-content h3 {
  font-size: 1.45rem;
  margin: 40px 0 14px;
  color: var(--color-text);
}

.post-content h4 {
  font-size: 1.25rem;
  margin: 32px 0 12px;
  color: var(--color-text);
}

.post-content h5 {
  font-size: 1.125rem;
  margin: 28px 0 10px;
  color: var(--color-text);
}

.post-content h6 {
  font-size: 1.125rem;
  margin: 24px 0 8px;
  color: var(--color-text);
}

.post-content p {
  margin-bottom: 20px;
  text-wrap: pretty;
}

.post-content ul,
.post-content ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 8px;
  text-wrap: pretty;
}

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

.post-content img {
  border-radius: var(--radius);
  margin: 20px 0;
  max-width: 100%;
  height: auto;
}

.post-content hr {
  margin: 40px 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

.post-content .kg-gallery-card {
  margin: 24px 0;
  max-width: 100%;
  overflow: hidden;
}

.post-content .kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.post-content .kg-gallery-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.post-content .kg-gallery-image {
  flex: 1;
  min-width: 0;
}

.post-content .kg-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 0;
}

.post-content .kg-gallery-card figcaption {
  text-align: left;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

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

.post-content .kg-embed-card iframe {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Buttons and CTA links in post content — no underline */
.post-content a[href*="leadhub"],
.post-content a[class*="btn"],
.post-content .kg-card a,
.post-content a:has(strong),
.post-content a:has(img) {
  text-decoration: none;
}

/* Ghost embedded button cards and CTA cards */
.post-content .kg-btn,
.post-content .kg-button-card a,
.post-content .kg-cta-card a,
.post-content .kg-signup-card a,
.post-content .kg-header-card a {
  background: #FF5D2A !important;
  color: #fff !important;
  padding: 22px 32px !important;
  border-radius: var(--radius-full) !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  text-decoration: none !important;
  display: inline-block;
  transition: background 0.2s !important;
}

.post-content .kg-btn:hover,
.post-content .kg-button-card a:hover,
.post-content .kg-cta-card a:hover,
.post-content .kg-signup-card a:hover,
.post-content .kg-header-card a:hover {
  background: #F54A00 !important;
  color: #fff !important;
}

/* WP-style buttons migrated as inline HTML */
.post-content a[style*="background"],
.post-content a[style*="padding"],
.post-content .wp-block-button a,
.post-content .wp-block-buttons a,
.post-content a[class*="button"],
.post-content a[class*="cta"] {
  text-decoration: none;
}

.post-content figcaption {
  text-align: left;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.post-content .kg-width-wide {
  width: 75%;
  max-width: 75%;
}

.post-content .kg-width-full {
  width: 50%;
  max-width: 50%;
}

/* ---------- Table of Contents ---------- */
.toc {
  background: var(--color-bg-sidebar);
  border-radius: var(--radius-lg);
  padding: clamp(10px, 1.5vw, 16px) clamp(12px, 1.5vw, 24px);
  margin-bottom: 32px;
}

@media (min-width: 1500px) {
  .post {
    position: relative;
  }

  .toc {
    position: absolute;
    top: 0;
    right: calc(100% + clamp(10px, 1.5vw, 48px));
    width: calc((100vw - var(--content-width)) / 2 - clamp(10px, 2vw, 60px));
    max-width: 280px;
    min-width: 180px;
    margin: 0;
  }

  .toc__item {
    line-height: 1.05;
    margin-bottom: 1px;
  }
}

.toc__title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
  margin: 0 0 8px;
}

.toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc__item {
  margin-bottom: 2px;
  line-height: 1.2;
}

.toc__item a {
  color: var(--color-text-secondary);
  font-size: clamp(0.78rem, 0.8vw, 0.85rem);
  text-decoration: none;
  transition: color 0.2s;
}

.toc__item--h2 > a {
  font-weight: 600;
}

.toc__item--h2 {
  margin-top: clamp(4px, 0.5vw, 8px);
}

.toc__item--h2:first-child {
  margin-top: 0;
}

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

.toc__item a.is-active {
  color: var(--color-accent);
}

.toc__item--h3 {
  margin-top: clamp(2px, 0.4vw, 6px);
}

.toc__item--h3::before {
  content: "–";
  color: var(--color-text-muted);
  margin-right: 6px;
}

.toc__item--h3 {
  padding-left: clamp(6px, 1vw, 12px);
}

.toc__item--h4::before {
  content: "–";
  color: var(--color-text-muted);
  margin-right: 6px;
}

.toc__item--h4 {
  padding-left: clamp(12px, 1.5vw, 24px);
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--color-bg-sidebar);
  border-radius: var(--radius-lg);
  padding: 24px;
  align-self: start;
  position: sticky;
  top: 80px;
}

.sidebar__title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-accent);
}

.sidebar__post {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar__post:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.sidebar__post > a {
  flex-shrink: 0;
  width: 80px;
  height: 60px;
}

.sidebar__post-image {
  width: 80px;
  height: 60px;
  border-radius: var(--radius);
  object-fit: cover;
  display: block;
}

.sidebar__post-title {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
}

.sidebar__post-title a {
  color: var(--color-text);
}

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

.sidebar__post-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ---------- Tag Page ---------- */
.tag-header {
  margin-bottom: 40px;
}

.tag-header__title {
  font-size: 2rem;
  margin-bottom: 8px;
  font-weight: 700;
}

.tag-header__description {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.tag-header__count {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-footer-bg);
  padding: 40px 20px;
  margin-top: 60px;
}

.site-footer__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer__copyright {
  color: var(--color-footer-text);
  font-size: 0.85rem;
}

.site-footer__social {
  display: flex;
  gap: 16px;
}

.site-footer__social a {
  color: var(--color-footer-text);
  font-size: 1.2rem;
  transition: color 0.2s;
}

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

/* Full footer (leadhub.co style) */
.site-footer--full {
  padding: 0;
}

.site-footer__top {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px 20px 32px;
  display: flex;
  gap: 48px;
}

.site-footer__brand {
  flex-shrink: 0;
}

.site-footer__logo {
  height: 28px;
  width: auto;
}

.site-footer__columns {
  display: flex;
  gap: 48px;
  flex: 1;
}

.site-footer__col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer__col-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-footer-text);
  margin-bottom: 4px;
}

.site-footer__col a {
  color: var(--color-footer-text);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s;
}

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

.site-footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 20px 20px 32px;
  text-align: center;
}

.site-footer__legal {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.site-footer__legal a {
  color: var(--color-footer-text);
  font-size: 0.75rem;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.site-footer__legal a:hover {
  opacity: 1;
}

.site-footer__company {
  color: var(--color-footer-text);
  font-size: 0.7rem;
  opacity: 0.5;
  margin-bottom: 8px;
}

.site-footer--full .site-footer__copyright {
  opacity: 0.5;
  font-size: 0.75rem;
}

.site-footer--full .site-footer__social {
  margin-top: 8px;
}

@media (max-width: 768px) {
  .site-footer__top {
    flex-direction: column;
    gap: 32px;
  }

  .site-footer__columns {
    flex-direction: column;
    gap: 24px;
  }
}

/* Post inside sidebar layout - remove inner max-width constraints */
.site-content--with-sidebar .post-header,
.site-content--with-sidebar .post-content,
.site-content--with-sidebar .post-feature-image,
.site-content--with-sidebar .post-tags {
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .site-content--with-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .post-card--featured {
    grid-column: 1;
  }

  .post-content .kg-gallery-row {
    flex-wrap: wrap;
  }

  .post-content .kg-gallery-image {
    flex: 1 1 calc(50% - 4px);
  }
}

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

  .site-nav.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 20px;
    gap: 16px;
  }

  .menu-toggle {
    display: block;
  }

  .post-header__title {
    font-size: 1.6rem;
  }

  .post-content {
    font-size: 1rem;
  }

  .site-footer__inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .post-content .kg-gallery-row {
    flex-direction: column;
  }

  .post-content .kg-gallery-image {
    flex: 1 1 100%;
  }
}

/* ---------- Search modal ---------- */
.search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
}

.search-modal.is-open {
  display: flex;
}

.search-modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.search-modal__content {
  position: relative;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  margin: 0 20px;
}

.search-modal__input {
  width: 100%;
  padding: 18px 24px;
  border: none;
  outline: none;
  font-size: 1.1rem;
  font-family: inherit;
  background: var(--color-bg);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

.search-modal__results {
  max-height: 400px;
  overflow-y: auto;
}

.search-modal__results a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s;
}

.search-result__image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.search-result__text {
  min-width: 0;
}

.search-modal__results a:hover {
  background: var(--color-bg-card);
}

.search-modal__results a:last-child {
  border-bottom: none;
}

.search-modal__results .search-result__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.search-modal__results .search-result__excerpt {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.search-modal__empty {
  padding: 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ---------- Admin edit button ---------- */
.lh-admin-edit {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: background 0.2s;
}

.lh-admin-edit:hover {
  background: #F54A00;
  color: #fff;
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
