/* === OMEGA PERMITS BLOG SYSTEM === */
/* Professional CSS Architecture with 30+ Years Best Practices */

/* === CSS CUSTOM PROPERTIES === */
:root {
  /* Color System */
  --color-primary: #0d6efd;
  --color-primary-dark: #0a58ca;
  --color-accent: #3296a5;
  --color-text: #333;
  --color-heading: #111;
  --color-muted: #444;
  --color-white: #ffffff;
  --color-black: #000000;

  /* CTA Colors */
  --cta-primary: #0d6efd;
  --cta-primary-dark: #0a58ca;
  --cta-glow: rgba(13, 110, 253, 0.25);
  --cta-hover-primary: #8b5cf6;
  --cta-hover-dark: #7c3aed;
  --cta-hover-glow: rgba(139, 92, 246, 0.25);

  /* Typography Scale */
  --font-size-xs: 0.75rem;
  /* 12px */
  --font-size-sm: 0.875rem;
  /* 14px */
  --font-size-base: 1.125rem;
  /* 18px */
  --font-size-lg: 1.25rem;
  /* 20px */
  --font-size-xl: 1.5rem;
  /* 24px */
  --font-size-2xl: 1.75rem;
  /* 28px */

  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  /* 4px */
  --space-sm: 0.5rem;
  /* 8px */
  --space-md: 1rem;
  /* 16px */
  --space-lg: 1.5rem;
  /* 24px */
  --space-xl: 2rem;
  /* 32px */
  --space-2xl: 2.5rem;
  /* 40px */
  --space-3xl: 3rem;
  /* 48px */

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 50rem;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === BASE STYLES === */
.blog-content-area {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY SYSTEM === */
.blog-content-area article p,
.blog-content-area article li {
  font-size: var(--font-size-base);
  margin-bottom: var(--space-lg);
}

.blog-content-area h1,
.blog-content-area h2,
.blog-content-area h3,
.blog-content-area h4,
.blog-content-area h5,
.blog-content-area h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-heading);
}

.blog-content-area h1.display-5 {
  font-weight: var(--font-weight-bold);
}

.blog-content-area h2.h3 {
  font-weight: var(--font-weight-semibold);
}

/* === COMPONENT STYLES === */

/* Table of Contents */
.toc-sidebar {
  position: sticky;
  top: 7.5rem;
  height: fit-content;
  max-height: calc(100vh - 8.75rem);
  overflow-y: auto;
  padding-right: var(--space-sm);
}

.toc-card,
.toc-mobile-card {
  background: var(--color-white);
  border: 2px solid var(--color-black);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-3xl);
  transform: scale(1.03);
  transform-origin: top left;
}

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

.toc-item {
  margin-bottom: var(--space-sm);
}

.toc-link {
  display: block;
  color: var(--color-black);
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border: 1px solid transparent;
  transition: all var(--transition-normal);
}

.blog-content-area .toc-link {
  font-weight: var(--font-weight-medium);
  font-size: 0.9375rem;
  /* 15px */
  color: var(--color-muted);
}

.toc-link.active,
.blog-content-area .toc-link.active {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
  transform: translateX(var(--space-xs));
}

.toc-card .toc-title,
.toc-mobile-card .toc-toggle span {
  font-size: var(--font-size-base);
}

.toc-card .toc-list .toc-link,
.toc-mobile-card .toc-list .toc-link {
  font-size: var(--font-size-sm);
  padding: 0.45rem 0.8rem;
}

/* Mobile TOC Toggle */
.d-block.d-lg-none .toc-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ccc;
  padding: var(--space-sm) 0;
}

.toc-toggle-icon {
  font-size: var(--font-size-lg);
  cursor: pointer;
  color: inherit;
}

.toc-toggle-icon:hover,
.toc-toggle-icon:focus {
  color: inherit;
  background: none;
  box-shadow: none;
}

/* Post Meta Information */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}

.post-meta .mx-2 {
  margin: 0 var(--space-sm);
}

/* Micro CTA Button */
.micro-cta {
  padding: var(--space-sm) 1.25rem;
  color: var(--color-white);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  background: linear-gradient(135deg, var(--cta-primary-dark) 0%, var(--cta-primary) 100%);
  border: 1px solid var(--cta-primary-dark);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  display: inline-block;
  transition: transform var(--transition-normal),
    box-shadow var(--transition-normal),
    filter var(--transition-normal),
    background var(--transition-normal),
    border-color var(--transition-normal);
}

.micro-cta:hover,
.micro-cta:focus-visible {
  color: var(--color-white);
  text-decoration: none;
  background: linear-gradient(135deg, var(--cta-hover-dark) 0%, var(--cta-hover-primary) 100%);
  border-color: var(--cta-hover-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px var(--cta-hover-glow);
  filter: brightness(1.1);
}

.micro-cta:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  filter: brightness(1);
  transition-duration: 0.1s;
}

.micro-cta:focus-visible {
  outline: 2px solid var(--cta-primary);
  outline-offset: 2px;
}

/* === UTILITY CLASSES === */
.emph {
  font-weight: var(--font-weight-semibold);
  color: var(--color-black);
}

/* Card styles */
.card-img-top {
  aspect-ratio: 4 / 3;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  background: #e3f6f9;
}

/* === RESPONSIVE DESIGN === */

/* Mobile Styles */
@media (max-width: 991.98px) {

  /* Layout Overrides */
  header .container {
    text-align: left !important;
  }

  /* Typography Adjustments */
  header h1.display-5 {
    font-size: var(--font-size-2xl);
    line-height: var(--line-height-tight);
    text-align: left;
  }

  header .lead {
    font-size: var(--font-size-base);
    max-width: 100%;
    text-align: left;
  }

  header .breadcrumb .breadcrumb-item a,
  header .breadcrumb .breadcrumb-item.active {
    font-size: var(--font-size-md);
  }

  article p,
  article li {
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
  }

  /* TOC Mobile Adjustments */
  .toc-toggle {
    padding: var(--space-md) 0;
    margin-bottom: var(--space-2xl);
  }

  .toc-toggle>span {
    font-size: var(--font-size-lg) !important;
  }

  .toc-toggle-icon {
    font-size: var(--space-xl) !important;
  }

  #mobileToc .toc-link,
  .toc-link {
    font-size: 0.8125rem;
    /* 13px */
    padding: var(--space-xs) 0.625rem;
  }

  /* Post Meta Mobile Grid */
  .post-meta {
    display: grid !important;
    grid-template-columns: auto 1fr;
    column-gap: 0.4rem;
    row-gap: var(--space-sm);
    align-items: center;
  }

  .post-meta .mx-2 {
    display: none !important;
  }

  .post-meta>i {
    grid-column: 1;
  }

  .post-meta>time,
  .post-meta>[itemprop="author"] {
    grid-column: 2;
    display: flex;
    align-items: center;
    white-space: nowrap;
  }

  .post-meta>.read-time {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    margin-left: 0 !important;
    text-align: left;
    white-space: nowrap;
  }

  /* Mobile TOC Card */
  #mobileToc .card {
    background: var(--color-white);
    border: 2px solid var(--color-black);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
    box-shadow: var(--shadow-md);
  }

  #mobileToc .toc-list {
    margin: 0;
    padding: 0;
  }

  #mobileToc .toc-item {
    margin-bottom: var(--space-sm);
  }

  #mobileToc .toc-link {
    display: block;
    color: var(--color-black);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    border: 1px solid transparent;
    transition: all var(--transition-normal);
  }

  #mobileToc .toc-link.active {
    color: var(--color-accent);
    font-weight: var(--font-weight-semibold);
    transform: translateX(var(--space-xs));
  }

  /* Mobile CTA Enhancement */
  .micro-cta {
    font-size: 0.9rem;
    padding: 0.6rem 1.4rem;
    min-height: 44px;
    /* iOS accessibility guideline */
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Desktop Styles */
@media (min-width: 992px) {
  .post-meta {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0;
  }

  .post-meta .mx-2 {
    display: inline-block;
  }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {

  .micro-cta,
  .toc-link {
    transition: none;
  }

  .micro-cta:hover {
    transform: none;
  }

  .toc-link.active {
    transform: none;
  }
}

/* Focus management for keyboard users */
.micro-cta:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {

  .toc-card,
  #mobileToc .card {
    border-width: 3px;
  }

  .micro-cta {
    border-width: 2px;
  }
}

/* === PAGER → MATCH TILE CARD LOOK ======================================= */
/* Card wrapper around the pagination (added in JS as .pager-card) */
#pager.op-pagination .pager-card {
  background: #fff;             /* same as your tiles */
  border: 0;
  border-radius: 1rem;          /* close to .rounded-4 feel */
  box-shadow: var(--shadow-lg); /* same depth as tiles */
  padding: .5rem .75rem;        /* breathing room around the bar */
}

/* Make the inner pagination bar transparent so the card shows through */
#pager.op-pagination .pager-card .pagination {
  background: transparent;
  border: 0;
  box-shadow: none;
  gap: var(--space-xs);
  padding: 0;                   /* outer card now controls the padding */
}

/* Page buttons → keep Omega style but harmonize radius with cards */
#pager.op-pagination .page-link {
  border-radius: var(--radius-lg);    /* slightly squared, like card corners */
  border: 1px solid rgba(0,0,0,0.06);
  background: #fff;
  color: var(--color-accent);
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 .8rem;
  font-weight: var(--font-weight-semibold);
}

/* Hover/active — keep your brand gradient highlight */
#pager.op-pagination .page-link:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px #3296a5;
  border-color: #3296a5;
  filter: brightness(1.02);
}

#pager.op-pagination .page-item.active .page-link {
  color: #fff;
  border-color: var(--color-accent);
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent) 100%);
  box-shadow: 0 8px 22px var(--cta-glow);
  transform: translateY(-1px);
}

/* Ellipsis remains subtle */
#pager.op-pagination .page-ellipsis .page-link {
  background: transparent;
  border-color: transparent;
  color: var(--color-muted);
  cursor: default;
  box-shadow: none;
  min-width: auto;
  padding: 0 .25rem;
}

/* Mobile parity: keep all items visible horizontally */
#pager.op-pagination .pagination {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; /* Firefox */
}

/* Comfy tap targets on phones */
@media (max-width: 767.98px) {
  #pager.op-pagination .page-item { display: inline-flex !important; }
  #pager.op-pagination .page-link { min-width: 2.6rem; height: 2.6rem; }
}

/* Optional edge fade hint */
#pager.op-pagination .pagination::before,
#pager.op-pagination .pagination::after {
  content: "";
  position: sticky;
  top: 0; bottom: 0;
  width: 16px;
  pointer-events: none;
}
/* #pager.op-pagination .pagination::before { left: 0;  background: linear-gradient(90deg, rgba(255,255,255,1), rgba(255,255,255,0)); }
#pager.op-pagination .pagination::after  { right: 0; background: linear-gradient(270deg, rgba(255,255,255,1), rgba(255,255,255,0)); } */
/* ======================================================================== */
/* ==========================================
   BLOG ARCHIVE
   Complete article index below the paginated grid. Every article stays linked
   from /blogs in the server-rendered HTML, since the pager is buttons rather
   than links and can't be followed without JavaScript.
   ========================================== */

.blog-archive {
  background: var(--color-white);
  border: 1px solid #dbe7ea;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: 0 2px 10px rgba(2, 36, 91, 0.06);
}

/* Collapsed by default: keeps the page short while every link stays in the
   server-rendered HTML for crawlers. */
.blog-archive-summary {
  cursor: pointer;
  list-style: none;
  padding-right: 2rem;
  position: relative;
}

.blog-archive-summary::-webkit-details-marker {
  display: none;
}

/* Chevron sits at the right edge and flips when the section opens. */
.blog-archive-summary::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0.3em;
  width: 1rem;
  height: 1rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%233296a5'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: contain;
  transition: transform var(--transition-normal);
}

.blog-archive-details[open] .blog-archive-summary::after {
  transform: rotate(180deg);
}

.blog-archive-summary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.blog-archive-title {
  font-size: 1.35rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  margin: 0;
}

.blog-archive-body {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid #dbe7ea;
}

.blog-archive-group {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid #dbe7ea;
  margin: var(--space-xl) 0 var(--space-md);
}

.blog-archive-group:first-of-type {
  margin-top: 0;
}

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

.blog-archive-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: 0.4rem 0;
  break-inside: avoid;
}

.blog-archive-link {
  color: var(--color-heading);
  text-decoration: none;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  border-bottom: 1px solid transparent;
  transition: color var(--transition-normal), border-color var(--transition-normal);
}

.blog-archive-link:hover,
.blog-archive-link:focus {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.blog-archive-meta {
  flex-shrink: 0;
  margin-left: auto;
  padding-left: var(--space-sm);
  font-size: var(--font-size-xs);
  color: #7b8a8f;
  white-space: nowrap;
}

/* Long titles need the room, so only split into columns once it's genuinely wide. */
@media (min-width: 1200px) {
  .blog-archive-list {
    columns: 2;
    column-gap: var(--space-2xl);
  }
}

@media (max-width: 575.98px) {
  .blog-archive {
    padding: var(--space-lg);
  }

  .blog-archive-item {
    flex-direction: column;
    gap: 0.15rem;
  }

  .blog-archive-meta {
    margin-left: 0;
    padding-left: 0;
  }
}
