/*
Theme Name: Arabic Academy HK Blog
Theme URI: http://arabic.hk/
Author: Arabic Academy Team
Description: Custom WordPress theme for Arabic Academy Hong Kong.
Version: 1.4.0
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: arabic-academy-hk
*/

@import url("https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;0,1000;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900;1,1000&display=swap");

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --primary-color: #077a7d;
  --primary-dark: #055b5e;
  --secondary-color: #d4ac0d;
  --text-dark: #1a242f;
  --text-light: #3e5771;
  --text-lighter: #507192;
  --bg-light: #f0fdfa;
  --bg-white: #ffffff;
  --border-color: #e6e6e6;
  --transition: all 0.3s ease;
  --navbar-height: 80px;
  --radius-card: 16px;
  --radius-sm: 8px;
  --radius-pill: 50px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
  background: var(--bg-white);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: system-ui, sans-serif;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}
a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

::selection {
  background: var(--primary-color);
  color: #fff;
}
::-moz-selection {
  background: var(--primary-color);
  color: #fff;
}

a:focus,
button:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ============================================================
   MOBILE NAV
   ============================================================ */
#mobile-nav.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
#mobile-nav:not(.hidden) {
  transform: translateY(0);
  opacity: 1;
}

/* ============================================================
   BLOG LISTING — HEADER
   ============================================================ */
.blog-header {
  padding: calc(var(--navbar-height) + 12rem) 0 5rem;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  text-align: center;
  overflow: hidden;
}

.blog-header-content {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 0 auto;
}

.blog-header-content h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.blog-header-content p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  opacity: 0.92;
  line-height: 1.65;
}

/* ============================================================
   BLOG LISTING — GRID
   ============================================================ */
.blog-content {
  padding: 4rem 0 5rem;
  background: var(--bg-light);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  width: 100%;
}

/* ============================================================
   BLOG CARD
   ============================================================ */
.blog-card {
  background: var(--bg-white);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(7, 122, 125, 0.07);
  border: 1px solid rgba(7, 122, 125, 0.09);
  display: flex;
  flex-direction: column;
  position: relative;
  transition:
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s ease;
  cursor: pointer;
  width: 100%;
  min-width: 0;
}

.blog-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(7, 122, 125, 0.16);
  border-color: rgba(7, 122, 125, 0.25);
}
.blog-card:hover::before {
  opacity: 1;
}
.blog-card:active {
  transform: translateY(-3px);
}

.blog-image {
  position: relative;
  display: block;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: linear-gradient(135deg, #e8f7f7, #d0efef);
  flex-shrink: 0;
}

.blog-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    filter 0.4s ease;
  filter: brightness(0.97);
}

.blog-card:hover .blog-image img {
  transform: scale(1.06);
  filter: brightness(1.02);
}

.blog-category {
  position: absolute;
  top: 14px;
  left: 14px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  z-index: 2;
  box-shadow: 0 2px 10px rgba(7, 122, 125, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.blog-card-content {
  padding: 1.6rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.blog-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-lighter);
}

.blog-meta .blog-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.blog-meta .blog-date::before {
  font-size: 0.85rem;
  line-height: 1;
}

.blog-card-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
  font-family: sans-serif;
  word-wrap: break-word;
  overflow-wrap: break-word;
  transition: color 0.3s ease;
}

.blog-card-content h2 a {
  color: inherit;
}
.blog-card-content h2 a:hover,
.blog-card:hover .blog-card-content h2 {
  color: var(--primary-color);
}

.blog-excerpt {
  color: var(--text-light);
  font-size: 0.875rem;
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.blog-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  margin-top: auto;
  color: var(--primary-color);
  font-weight: 700;
  font-family: sans-serif;
  font-size: 0.875rem;
  padding: 0.55rem 1.2rem;
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-sm);
  transition:
    background 0.3s ease,
    color 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
  white-space: nowrap;
}

.blog-read-more:hover {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(7, 122, 125, 0.3);
}

.no-posts {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-light);
  font-size: 1.1rem;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  margin-top: 4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.875rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-dark);
  font-weight: 600;
  font-family: sans-serif;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination .page-numbers:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(7, 122, 125, 0.15);
}

.pagination .page-numbers.current {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 14px rgba(7, 122, 125, 0.3);
}

.pagination .prev,
.pagination .next {
  padding: 0 1.25rem;
}

/* ============================================================
   SINGLE POST — HERO
   Full viewport-height section, content perfectly centred
   ============================================================ */
.blog-hero {
  margin-top: 5rem;
  position: relative;
  width: 100%;
  min-height: 500px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  /* Centre everything — back link, meta, title */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Space for fixed navbar */
  padding-top: var(--navbar-height);
}

/* Fallback when no featured image */
.blog-hero:not([style*="background-image"]) {
  background: linear-gradient(160deg, #0d1f2d 0%, #1a3a4a 50%, #0f3040 100%);
}

/* Dark overlay — stronger in centre for text contrast */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.6) 50%,
    rgba(0, 0, 0, 0.75) 100%
  );
  z-index: 1;
}

/* Inner wrapper — centred, max-width, text-align center */
.blog-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 24px;
  color: white;
}

/* Back to blog link */
.back-to-blog {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
  font-family: sans-serif;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  padding: 0.45rem 1.1rem;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(6px);
  background: rgba(255, 255, 255, 0.1);
  transition:
    background 0.3s ease,
    border-color 0.3s ease,
    transform 0.3s ease;
  /* Remove any inherited ::before arrows */
  text-decoration: none;
}

.back-to-blog:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateX(-3px);
}

/* Meta row: date + category pill */
.hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.88);
}

.hero-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.88);
}

.hero-category {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: white;
  padding: 0.3rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Hero title — centred, large, readable */
.hero-title {
  font-size: clamp(1.75rem, 4.5vw, 3.25rem);
  font-weight: 800;
  color: white;
  line-height: 1.2;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.55);
  letter-spacing: -0.3px;
  margin: 0;
}

/* ============================================================
   SINGLE POST — ARTICLE BODY
   ============================================================ */
.blog-article {
  padding: 4rem 0 5rem;
  background: var(--bg-white);
}

.blog-article-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.blog-article-body {
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--text-dark);
}

.blog-article-body h2 {
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  color: var(--primary-color);
  font-weight: 700;
  position: relative;
  padding-bottom: 0.6rem;
}

.blog-article-body h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 52px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border-radius: 2px;
}

.blog-article-body h3 {
  font-size: 1.35rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-dark);
  font-weight: 700;
}

.blog-article-body p {
  margin-bottom: 1.5rem;
  text-align: justify;
}

.blog-article-body ul,
.blog-article-body ol {
  margin-bottom: 1.5rem;
  padding-left: 1.75rem;
}

.blog-article-body li {
  margin-bottom: 0.6rem;
  line-height: 1.75;
}

.blog-article-body blockquote {
  margin: 2.5rem 0;
  padding: 1.5rem 2rem;
  background: var(--bg-light);
  border-left: 4px solid var(--primary-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-light);
  font-size: 1.05rem;
  line-height: 1.75;
}

.blog-article-body blockquote p {
  margin-bottom: 0;
}

.blog-article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 2rem auto;
  box-shadow: 0 4px 20px rgba(7, 122, 125, 0.1);
}

.blog-article-body a {
  color: var(--primary-color);
  text-decoration: underline;
  text-decoration-color: rgba(7, 122, 125, 0.35);
  text-underline-offset: 3px;
  transition:
    color 0.2s ease,
    text-decoration-color 0.2s ease;
}

.blog-article-body a:hover {
  color: var(--primary-dark);
  text-decoration-color: var(--primary-dark);
}

/* Remove WordPress default <hr> that appears before post navigation */
.blog-article-content hr {
  display: none;
}

/* ============================================================
   POST NAVIGATION
   ============================================================ */
.post-navigation {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1.5px solid var(--border-color);
}

.nav-links {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.nav-previous,
.nav-next {
  flex: 1;
}
.nav-next {
  text-align: right;
}

.nav-subtitle {
  display: block;
  font-size: 0.78rem;
  color: var(--text-lighter);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.nav-title {
  font-weight: 700;
  color: var(--primary-color);
  font-family: sans-serif;
  font-size: 0.95rem;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.nav-previous a:hover .nav-title,
.nav-next a:hover .nav-title {
  color: var(--primary-dark);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: linear-gradient(135deg, #111827, #1e293b);
  color: white;
  padding: 5rem 0 2rem;
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-color),
    var(--secondary-color),
    transparent
  );
  opacity: 0.7;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3.5rem;
  margin-bottom: 4rem;
  position: relative;
  z-index: 1;
}

.footer-logo {
  height: 56px;
  width: auto;
  margin-bottom: 1.5rem;
  filter: brightness(0) invert(1);
}

.footer-section p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
  line-height: 1.7;
}

.footer-section h4 {
  margin-bottom: 1.25rem;
  font-size: 1rem;
  color: white;
  font-family: sans-serif;
  font-weight: 700;
  position: relative;
  padding-bottom: 0.75rem;
}

.footer-section h4::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 36px;
  height: 2px;
  background: var(--primary-color);
  border-radius: 1px;
}

.footer-section ul {
  list-style: none;
}
.footer-section ul li {
  margin-bottom: 0.6rem;
}

.footer-section ul li a {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
  display: inline-block;
}

.footer-section ul li a:hover {
  color: var(--primary-color);
  transform: translateX(4px);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  position: relative;
  z-index: 1;
}

.footer-bottom a {
  color: var(--primary-color);
  transition: color 0.2s ease;
}
.footer-bottom a:hover {
  color: var(--secondary-color);
}

/* ============================================================
   SHIMMER
   ============================================================ */
@keyframes shimmer {
  0% {
    background-position: -800px 0;
  }
  100% {
    background-position: 800px 0;
  }
}

.blog-card.loading .blog-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.28) 50%,
    transparent 100%
  );
  background-size: 800px 100%;
  animation: shimmer 1.8s infinite linear;
}

/* ============================================================
   RESPONSIVE ≤ 1024px — 2 columns
   ============================================================ */
@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
  }
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

/* ============================================================
   RESPONSIVE ≤ 768px — 1 column
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --navbar-height: 64px;
  }

  .blog-header {
    padding: calc(var(--navbar-height) + 5rem) 0 4rem;
  }
  .blog-header::after {
    height: 40px;
  }
  .blog-content {
    padding: 3rem 0 4rem;
  }

  .blog-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .blog-image {
    height: 200px;
  }
  .blog-card-content {
    padding: 1.4rem;
  }
  .blog-card-content h2 {
    font-size: 1.05rem;
  }

  /* Hero */
  .blog-hero {
    min-height: 440px;
  }
  .blog-hero-inner {
    padding: 3rem 20px;
  }
  .hero-title {
    font-size: clamp(1.5rem, 5vw, 2.25rem);
  }

  /* Article */
  .blog-article {
    padding: 3rem 0 4rem;
  }
  .blog-article-content {
    padding: 0 16px;
  }
  .blog-article-body {
    font-size: 1rem;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Nav */
  .nav-links {
    flex-direction: column;
    gap: 1.25rem;
  }
  .nav-next {
    text-align: left;
  }

  /* Pagination */
  .pagination {
    gap: 0.3rem;
  }
  .pagination .page-numbers {
    min-width: 40px;
    height: 40px;
    font-size: 0.85rem;
  }
}

/* ============================================================
   RESPONSIVE ≤ 480px
   ============================================================ */
@media (max-width: 480px) {
  .blog-header {
    padding: calc(var(--navbar-height) + 5rem) 0 3.5rem;
  }
  .blog-content {
    padding: 2.5rem 0 3rem;
  }

  .blog-card {
    border-radius: 12px;
  }
  .blog-card-content {
    padding: 1.2rem;
  }

  .blog-category {
    font-size: 0.68rem;
    padding: 0.3rem 0.75rem;
  }
  .blog-meta {
    font-size: 0.75rem;
  }
  .blog-card-content h2 {
    font-size: 1rem;
    margin-bottom: 0.6rem;
  }
  .blog-excerpt {
    font-size: 0.85rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    margin-bottom: 1rem;
  }
  .blog-read-more {
    font-size: 0.8rem;
    padding: 0.45rem 0.9rem;
  }

  .blog-hero {
    min-height: 360px;
  }
  .blog-hero-inner {
    padding: 2.5rem 16px;
  }
  .hero-title {
    font-size: 1.55rem;
  }
}
