/* =========================================================
   BLOG-SPECIFIC STYLES
   ---------------------------------------------------------
   Styles for the blog landing page and blog post cards.
   Uses the existing BrandStyling.css design system.
========================================================= */

/* =========================================================
   0) BLOG PAGE OVERRIDES
========================================================= */

/* Remove canvas/animation elements for blog page */
.blog-page #canvas-wrapper,
.blog-page #pauseAnimationBtn {
  display: none !important;
}

/* Simple white background for blog */
.blog-page {
  background: var(--bg);
}

/* Absolute header for blog (overlays hero like services pages) */
.blog-page .site-header {
  position: absolute;
  background: transparent;
  border-bottom: none;
  box-shadow: none;
  transition: background 0.28s ease, box-shadow 0.28s ease;
  z-index: 50;
}

/* White navbar styling */
.blog-page .site-header .nav-link {
  text-decoration: none;
  color: #ffffff !important;
}

.blog-page .site-header .nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff !important;
}

.blog-page .site-header .nav-menu {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
}

.blog-page .site-header .nav-menu a {
  text-decoration: none;
  color: var(--primary-dark);
}

.blog-page .site-header .nav-menu a:hover {
  background: rgba(90, 167, 163, 0.1);
  color: var(--primary-dark);
}

/* White logo filter */
.blog-page .site-header .logo-style {
  filter: brightness(0) invert(1);
}

/* Fixed header and teal veil on scroll (mobile) */
@media (max-width: 768px){
  .blog-page .site-header{
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 60;
    background: transparent;
    --header-veil-opacity: 0;
  }
  .blog-page .site-header .inner{
    position: relative;
    z-index: 1;
  }
  .blog-page .site-header.header-scrolled{
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
  }
  .blog-page .site-header.header-scrolled::after{
    content:'';
    position:absolute;
    inset:0;
    height:80px;
    background: linear-gradient(
      180deg,
      rgba(90,167,163,0.98) 0%,
      rgba(68,131,129,0.94) 55%,
      rgba(53,98,102,0.88) 95%,
      rgba(53,98,102,0.10) 100%
    );
    pointer-events:none;
    z-index:0;
    opacity: var(--header-veil-opacity, 0);
  }
}

/* Language changer styling for blog page */
.blog-page #tl-lang .btn {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.blog-page #tl-lang .btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.blog-page #tl-lang .menu {
  background: var(--surface);
  border: 1px solid var(--border);
}

.blog-page #tl-lang .item {
  color: var(--text);
  background: transparent;
  border: none !important;
}

.blog-page #tl-lang .item:hover,
.blog-page #tl-lang .item:focus {
  background: var(--primary-08);
  border: none !important;
}

/* =========================================================
   1) BLOG LANDING PAGE LAYOUT
========================================================= */

/* Blog hero section */
.blog-hero {
  position: relative;
  padding: 8rem 1.5rem 30rem;
  z-index: 1;
  background-image: url('/Images/services/ink style abstract.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  isolation: isolate;
  overflow: visible;
  min-height: 600px;
  display: flex;
  align-items: center;
  margin-bottom: -22rem;
}

/* Gradient fade at bottom of hero */
.blog-hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
  background: none;
  pointer-events: none;
  z-index: 2;
}

.blog-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: linear-gradient(
    180deg,
    rgba(12,25,35,0.95) 0%,
    rgba(12,25,35,0.82) 30%,
    rgba(12,25,35,0.55) 60%,
    rgba(12,25,35,0.00) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* Inner container for grid layout */
.blog-hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
  position: relative;
  z-index: 3;
}

/* Left side - Title */
.blog-hero-left {
  text-align: left;
  padding-left: 1.5rem;
  padding-top: 1.2rem;
}

.blog-hero h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(3rem, 9vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Right side - Subtitle and description */
.blog-hero-right {
  text-align: left;
}

.blog-hero .blog-subtitle {
  font-size: 1.5rem;
  color: #ffffff;
  margin: 0 0 1rem;
  line-height: 1.4;
  font-weight: 600;
}

.blog-hero .blog-description {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  line-height: 1.7;
  max-width: 100%;
}

/* Desktop layout: title left, content right */
@media (min-width: 900px) {
  .blog-hero-inner {
    grid-template-columns: 1.2fr 1fr;
    column-gap: 3rem;
  }
}

/* Mobile adjustments */
@media (max-width: 899px) {
  .blog-hero {
    padding: 12rem 1.5rem 20rem;
    min-height: 500px;
    margin-bottom: -14rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .blog-hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .blog-hero-left {
    text-align: center;
    padding-left: 0;
    margin-bottom: 2rem;
  }
  
  .blog-hero-right {
    text-align: center;
  }
  
  .blog-hero h1 {
    font-size: clamp(3.5rem, 12vw, 5rem);
    margin-bottom: 0;
    font-weight: 900;
  }
  
  .blog-hero .blog-subtitle {
    font-size: 1.25rem;
  }
  
  .blog-hero .blog-description {
    font-size: 1rem;
  }
}

/* =========================================================
   FOOTER CENTERING
========================================================= */

.blog-page footer {
  text-align: center;
  max-width: 100%;
  margin: 0 auto;
}

/* =========================================================
   2) BLOG POSTS GRID
========================================================= */

.blog-posts-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  position: relative;
  z-index: 10;
}

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

/* Responsive grid: 1 column mobile, 2 tablet, 3 desktop */
@media (min-width: 640px) {
  .blog-posts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
  }
}

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

/* =========================================================
   3) BLOG POST CARD
========================================================= */

.blog-post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.blog-post-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

/* Post metadata (date and category) */
.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.post-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.post-category {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--primary-08);
  color: var(--primary-dark);
  border: 1px solid var(--primary);
}

/* Category color variants */
.post-category--education {
  background: var(--primary-08);
  color: var(--primary-dark);
  border-color: var(--primary);
}

.post-category--partnership {
  background: var(--success-08);
  color: var(--success);
  border-color: var(--success);
}

.post-category--tutorial {
  background: var(--accent-08);
  color: var(--accent);
  border-color: var(--accent);
}

.post-category--announcement {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border-color: #dc2626;
}

/* Post title */
.post-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 0.5rem;
  line-height: 1.3;
  letter-spacing: -0.5px;
}

.post-title a {
  color: var(--primary-dark);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Post subtitle */
.post-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  line-height: 1.5;
  font-weight: 500;
}

/* Post excerpt */
.post-excerpt {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0 0 1rem;
  flex-grow: 1;
}

/* Read more link */
.read-more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: gap 0.2s ease, color 0.2s ease;
  margin-top: auto;
}

.read-more-link::after {
  content: "→";
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.read-more-link:hover {
  color: var(--primary-dark);
  gap: 0.75rem;
}

.read-more-link:hover::after {
  transform: translateX(3px);
}

/* =========================================================
   4) BLOG POST CARD INTERACTIONS
========================================================= */

/* Subtle scale on card content when hovering */
.blog-post-card:hover .post-title,
.blog-post-card:hover .post-subtitle {
  transition: color 0.2s ease;
}

/* Focus state for accessibility */
.blog-post-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 var(--ring-size) var(--ring-color);
  border-color: var(--primary);
}

/* =========================================================
   5) EMPTY STATE
========================================================= */

.blog-empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
}

.blog-empty-state h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* =========================================================
   6) LOADING STATE
========================================================= */

.blog-loading {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
}

.blog-loading .loader {
  margin: 0 auto 1rem;
}

/* =========================================================
   7) RESPONSIVE ADJUSTMENTS
========================================================= */

@media (max-width: 639px) {
  .blog-post-card {
    padding: 1.25rem;
  }
  
  .post-title {
    font-size: 1.35rem;
  }
  
  .post-subtitle {
    font-size: 0.95rem;
  }
  
  .post-excerpt {
    font-size: 0.9rem;
  }
}

/* =========================================================
   8) ACCESSIBILITY ENHANCEMENTS
========================================================= */

/* Visually hidden but accessible to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.visually-hidden:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Ensure sufficient color contrast */
@media (prefers-contrast: high) {
  .post-category {
    border-width: 2px;
  }
  
  .blog-post-card {
    border-width: 2px;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .blog-post-card,
  .read-more-link,
  .read-more-link::after {
    transition: none;
  }
  
  .blog-post-card:hover {
    transform: none;
  }
}

/* =========================================================
   9) PRINT STYLES
========================================================= */

@media print {
  .blog-post-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .blog-post-card:hover {
    transform: none;
    box-shadow: none;
  }
  
  .read-more-link {
    display: none;
  }
}
