/* ============================================
   NordIQ Life Theme
   Fonts: Work Sans (body), Heebo (headings)
   Colors: White bg, #666 body, black headings
   ============================================ */

/* --- Fonts --- */
@font-face {
  font-family: 'Work Sans';
  src: url('/fonts/work-sans.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: 'Heebo';
  src: url('/fonts/heebo.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* --- Custom Properties --- */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f8f8f8;
  --color-text: #666666;
  --color-heading: #1a1a1a;
  --color-accent: #1a1a1a;
  --color-border: #e5e5e5;
  --color-meta: #727272;
  --color-link: #1a1a1a;
  --color-badge-bg: #1a1a1a;
  --color-badge-text: #ffffff;
  --color-card-bg: #ffffff;
  --color-footer-bg: #1a1a1a;
  --color-footer-text: #cccccc;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Heebo', -apple-system, BlinkMacSystemFont, sans-serif;
  --container-width: 1200px;
  --radius: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
}

[data-theme="dark"] {
  --color-bg: #1a1a1a;
  --color-bg-alt: #242424;
  --color-text: #b0b0b0;
  --color-heading: #e8e8e8;
  --color-accent: #e8e8e8;
  --color-border: #333333;
  --color-meta: #9a9a9a;
  --color-link: #e8e8e8;
  --color-badge-bg: #e8e8e8;
  --color-badge-text: #1a1a1a;
  --color-card-bg: #242424;
  --color-footer-bg: #111111;
  --color-footer-text: #aaaaaa;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
}

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

/* --- Base --- */
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  font-weight: 700;
  line-height: 1.3;
}

a { color: var(--color-link); text-decoration: none; }
a:hover { opacity: 0.8; }
img { max-width: 100%; height: auto; display: block; }

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

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

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.header-date {
  font-size: 0.8rem;
  color: var(--color-meta);
  white-space: nowrap;
}

.header-search {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg);
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  z-index: 50;
}

.header-search.open { display: block; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-toggle,
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-heading);
  padding: 6px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
}

.search-toggle:hover,
.theme-toggle:hover {
  background: var(--color-bg-alt);
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Nav toggle (hamburger) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-heading);
  transition: transform 0.2s;
}

.header-nav {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.main-nav li a {
  display: block;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
  white-space: nowrap;
  transition: color 0.2s;
}

.main-nav li a:hover,
.main-nav li a.active {
  color: var(--color-heading);
}

/* --- Hero Section --- */
.hero {
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.hero-link {
  display: block;
  position: relative;
}

.hero-image {
  aspect-ratio: 21/9;
  overflow: hidden;
}

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

.hero-link:hover .hero-image img {
  transform: scale(1.02);
}

.hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 32px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
}

.hero-content h1 {
  color: #fff;
  font-size: 2rem;
  margin-top: 8px;
}

.hero-meta {
  margin-top: 8px;
  font-size: 0.85rem;
  opacity: 0.9;
}

.hero-meta time { color: #fff; }

/* --- Category Badge --- */
.category-badge {
  display: inline-block;
  background: var(--color-badge-bg);
  color: var(--color-badge-text);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 2px;
}

.category-badge--small {
  font-size: 0.65rem;
  padding: 2px 8px;
}

/* --- Content Grid --- */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  margin: 32px 0;
}

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

.post-grid--related {
  grid-template-columns: repeat(3, 1fr);
}

/* --- Post Card --- */
.post-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.post-card-link {
  display: block;
  color: inherit;
}

.post-card-link:hover { opacity: 1; }

.post-card-image {
  aspect-ratio: 16/10;
  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-body {
  padding: 16px;
}

.post-card-title {
  font-size: 1rem;
  margin: 6px 0;
  line-height: 1.4;
}

.post-card .post-meta {
  font-size: 0.78rem;
  color: var(--color-meta);
}

.post-excerpt {
  font-size: 0.88rem;
  margin-top: 8px;
  color: var(--color-text);
  line-height: 1.6;
}

/* --- Single Post --- */
.single-post {
  padding-top: 24px;
}

/* Reading progress bar */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--color-accent);
  z-index: 200;
  transition: width 0.1s linear;
}

/* Now Reading sticky bar */
.now-reading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--color-accent);
  color: var(--color-badge-text);
  padding: 8px 0;
  z-index: 150;
  transform: translateY(-100%);
  transition: transform 0.3s;
  font-size: 0.85rem;
}

.now-reading-bar.visible {
  transform: translateY(0);
}

.now-reading-bar .container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.now-reading-label {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.now-reading-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Breadcrumb */
/* Post header with featured image side-by-side */
.post-header-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 0;
  padding: 20px 0;
}

.featured-image {
  border-radius: var(--radius);
  overflow: hidden;
}

.featured-image img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
}

.post-header h1 {
  font-size: 2.4rem;
  margin: 0 0 16px;
  line-height: 1.15;
}

.post-header .meta-category {
  color: var(--color-meta);
  font-weight: 600;
}

.post-header .meta-category:hover {
  color: var(--color-heading);
  opacity: 1;
}

.meta-sep {
  margin: 0 8px;
  color: var(--color-meta);
}

.breadcrumb {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-meta);
  padding: 16px 0;
  margin-bottom: 32px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.breadcrumb a { color: var(--color-meta); }
.breadcrumb a:hover { color: var(--color-heading); }
.breadcrumb .sep { margin: 0 6px; }
.breadcrumb-current { color: var(--color-heading); font-weight: 700; }

.post-meta {
  font-size: 0.85rem;
  color: var(--color-meta);
}

.post-meta .author {
  font-weight: 600;
  color: var(--color-heading);
}

.meta-sep { margin: 0 6px; }

/* Article body */
.article-body {
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: 720px;
}

.article-body h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
}

.article-body h3 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
}

.article-body p {
  margin-bottom: 1.2em;
}

.article-body img {
  border-radius: var(--radius);
  margin: 1.5em 0;
}

.article-body blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 12px 20px;
  margin: 1.5em 0;
  font-style: italic;
  color: var(--color-text);
  background: var(--color-bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-body ul, .article-body ol {
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}

.article-body li { margin-bottom: 0.4em; }

.article-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-body figure {
  margin: 1.5em 0;
}

.article-body figcaption {
  font-size: 0.85rem;
  color: var(--color-meta);
  margin-top: 8px;
  text-align: center;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}

.article-body th, .article-body td {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  text-align: left;
}

.article-body th {
  background: var(--color-bg-alt);
  font-weight: 600;
}

/* TOC block (from Rank Math) */
.toc {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 1.5em 0;
}

.toc nav ul {
  padding-left: 1.2em;
}

.toc nav li {
  margin-bottom: 6px;
}

/* Post tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2rem 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.tag {
  font-size: 0.8rem;
  color: var(--color-meta);
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  transition: all 0.2s;
}

.tag:hover {
  color: var(--color-heading);
  border-color: var(--color-heading);
  opacity: 1;
}

/* Share buttons */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1.5rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.share-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-heading);
  margin-right: 4px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.share-btn:hover {
  border-color: var(--color-heading);
  color: var(--color-heading);
  opacity: 1;
}

.share-facebook:hover { border-color: #1877f2; color: #1877f2; }
.share-x:hover { border-color: var(--color-heading); }
.share-pinterest:hover { border-color: #e60023; color: #e60023; }

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

.related-posts h2 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
}

/* --- Sidebar --- */
.sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}

.widget {
  margin-bottom: 32px;
}

.widget-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--color-accent);
}

.category-list {
  list-style: none;
}

.category-list li {
  border-bottom: 1px solid var(--color-border);
}

.category-list li a {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.9rem;
}

.category-list .count {
  color: var(--color-meta);
  font-size: 0.8rem;
}

/* Coffee button */
.widget-coffee p {
  font-size: 0.88rem;
  margin-bottom: 12px;
}

.coffee-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #ffdd00;
  color: #1a1a1a;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.coffee-btn:hover {
  background: #ffd000;
  opacity: 1;
}

/* Recent posts */
.recent-posts {
  list-style: none;
}

.recent-posts li {
  margin-bottom: 12px;
}

.recent-posts li a {
  display: flex;
  gap: 12px;
  align-items: center;
}

.recent-posts .thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.recent-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-heading);
  line-height: 1.3;
}

.recent-posts time {
  font-size: 0.75rem;
  color: var(--color-meta);
  text-transform: uppercase;
}

/* --- Section Title --- */
.section-title {
  font-size: 1.8rem;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-accent);
}

.section-desc {
  margin-bottom: 24px;
  color: var(--color-text);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin: 40px 0 20px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.page-link:hover {
  border-color: var(--color-heading);
  background: var(--color-heading);
  color: #fff;
  opacity: 1;
}

.page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.page-number:hover {
  border-color: var(--color-heading);
  opacity: 1;
}

.page-number.current {
  background: var(--color-heading);
  color: #fff;
  border-color: var(--color-heading);
  font-weight: 700;
}

/* --- Footer --- */
.site-footer {
  background: #1a1a1a;
  color: #aaa;
  margin-top: 40px;
}

.footer-main {
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
}

.footer-logo {
  height: 40px;
  margin-bottom: 16px;
}

.footer-about p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #aaa;
}

.footer-links h4 {
  color: #fff;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: #aaa;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #fff;
  opacity: 1;
}

.footer-social {
  border-top: 1px solid #333;
  padding: 20px 0;
}

.footer-social .container {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.footer-social a {
  color: #aaa;
  transition: color 0.2s;
}

.footer-social a:hover {
  color: #fff;
  opacity: 1;
}

.footer-bottom {
  text-align: center;
  padding: 20px 0;
  font-size: 0.85rem;
  color: #aaa;
  border-top: 1px solid #333;
}

/* --- Static pages --- */
.page-content {
  max-width: 800px;
  padding: 40px 20px;
}

.page-header h1 {
  font-size: 2rem;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.page-content .article-body img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

/* --- Pagefind overrides --- */
.pagefind-ui__search-input {
  font-family: var(--font-body) !important;
}

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

  .sidebar {
    position: static;
  }

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

  .header-date { display: none; }

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

  .post-grid--related {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }

  .header-nav {
    display: none;
  }

  .header-nav.open {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
  }

  .main-nav li a {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
  }

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

  .pagination {
    flex-wrap: wrap;
  }

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

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

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

  .hero-content {
    padding: 24px 20px;
  }

  .hero-image {
    aspect-ratio: 16/9;
  }

  .post-header h1 {
    font-size: 1.4rem;
  }

  .article-body {
    font-size: 1rem;
  }

  .share-buttons {
    flex-wrap: wrap;
  }
}
