/* ==========================================================
   Far Overseas — Blog (listing page + components shared with
   the article page). Everything is scoped under .blog-page or
   a .blog-* / .article-* class, so the homepage is untouched.

   Load order: after variables/base/navbar/footer/responsive.
   ========================================================== */

/* ---------- 1. Tokens ----------
   Hard-coded values are sampled from the blog design. Where the
   existing site already has a token, it is used first (var() with
   a fallback), so re-pointing these at variables.css is a
   one-place change. */
.blog-page {
  --blog-green-950: #082f24;
  --blog-green-900: rgba(0, 56, 58, 1);
  --blog-green-700: rgba(0, 56, 58, 1);
  --blog-green-500: rgba(0, 56, 58, 1);
  --blog-green-200: #cfe3d5;
  --blog-green-100: #e5efe7;

  --blog-ink: #17261f;
  --blog-muted: #58685f;
  --blog-paper: #f6f5ef;
  --blog-sand: var(--color-sand, #ecebe2);
  --blog-line: rgba(10, 61, 46, 0.12);

  --blog-radius: 14px;
  --blog-radius-lg: 20px;
  --blog-shadow: 0 1px 2px rgba(10, 61, 46, 0.05), 0 8px 24px rgba(10, 61, 46, 0.06);
  --blog-shadow-lift: 0 2px 4px rgba(10, 61, 46, 0.06), 0 16px 36px rgba(10, 61, 46, 0.12);

  --blog-font-heading: var(--font-heading, "Manrope", system-ui, sans-serif);
  --blog-font-body: var(--font-body, "Inter", system-ui, sans-serif);

  background: var(--blog-paper);
  color: var(--blog-ink);
}

.blog-page [hidden] { display: none !important; }
/* Read Full Article button animation */
.blog-featured .blog-btn-light {
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.blog-featured .blog-btn-light:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 56, 58, 0.18);
}

.blog-featured .blog-btn-light .btn-icon {
  transition: transform 0.25s ease;
}

.blog-featured .blog-btn-light:hover .btn-icon {
  transform: translateX(5px);
}

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

/* Current-page marker for the (unchanged) navbar */
.blog-page .navbar__link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--blog-green-500);
  text-decoration-thickness: 2px;
  text-underline-offset: 10px;
}

.blog-eyebrow {
  margin: 0 0 1rem;
  font: 600 0.78rem/1 var(--blog-font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blog-green-700);
}

/* ---------- 2. Hero ---------- */
.blog-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* --blog-nav-offset is set by js/blogs.js only if the navbar overlays content */
  padding: calc(var(--blog-nav-offset, 0px) + clamp(2.75rem, 5.5vw, 4.5rem)) 0 clamp(3.5rem, 6vw, 5rem);
  background: linear-gradient(180deg, #f4f2e8 0%, #e8efe2 100%);
}

.blog-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
}

.blog-hero__art {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.bh-glow-a { stop-color: #f8efcf; stop-opacity: 0.9; }
.bh-glow-b { stop-color: #f8efcf; stop-opacity: 0; }
.bh-hill--far { fill: #cddcc8; }
.bh-hill--mid { fill: #a9c4a6; }
.bh-hill--near { fill: #7ea987; }
.bh-rows path { fill: none; stroke: rgba(232, 241, 238, 0.22); stroke-width: 2; }
.bh-leaf-a { stop-color: #3f8a5c; }
.bh-leaf-b { stop-color: #0f5a43; }
.bh-vein { fill: none; stroke: rgba(230, 243, 232, 0.5); stroke-width: 2; stroke-linecap: round; }

.blog-hero__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.blog-hero__copy { max-width: 54rem; }

.blog-hero__title {
  margin: 0 0 1.25rem;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 200;
  font-size: clamp(2.7rem, 5vw, 4.8rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: rgba(14, 124, 123, 1);
}

.blog-hero__lead {
  max-width: 34rem;
  margin: 0 0 1.5rem;
  font: 400 clamp(1rem, 1.3vw, 1.075rem)/1.65 var(--blog-font-body);
  color: white;
}

.blog-hero__topics {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--blog-line);
  width: fit-content;
  font: 600 0.75rem/1 var(--blog-font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: translateY(-15px);
  color: white;
}

.blog-hero__topics span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 1.5rem;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}



/* ---------- 3. Featured article ---------- */

.blog-featured {
  padding-top: clamp(1.25rem, 2vw, 1.75rem);
}

.blog-featured__card {
  position: relative;
  min-height: 32rem;
  overflow: hidden;
  border-radius: var(--blog-radius-lg);
  background: var(--blog-green-900);
  color: #fff;
  box-shadow: var(--blog-shadow);
}

/* Full featured image */
.blog-featured__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  min-height: 100%;
}

.blog-featured__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

/* The image already contains a dark teal area on the left,
   so no extra fade/gradient is needed. */
.blog-featured__media::before {
  display: none;
}

.blog-featured__media.is-missing img {
  display: none;
}

.blog-featured__media.is-missing {
  background: radial-gradient(
    75% 95% at 78% 28%,
    #1c6a4e 0%,
    rgba(28, 106, 78, 0) 70%
  );
}

/* Text sits on top of the image */
.blog-featured__content {
  position: relative;
  z-index: 2;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;

  width: 58%;
  min-height: 32rem;
  padding: clamp(1.75rem, 3.6vw, 3.5rem);
}

.blog-featured__label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.1rem;
  font: 600 0.75rem/1 var(--blog-font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #08443d;
}

.blog-featured__label svg {
  width: 18px;
  height: 18px;
}

.blog-featured__title {
  margin: 0 0 1rem;
  max-width: 24ch;

  font: 700 clamp(1.5rem, 2.7vw, 2.4rem)/1.18 var(--blog-font-heading);
  letter-spacing: -0.02em;
  color: #f2f6f6;
}

.blog-featured__excerpt {
  max-width: 46ch;
  margin: 0 0 1.75rem;

  font: 400 0.95rem/1.65 var(--blog-font-body);
  color: rgba(255, 255, 255, 0.9);

  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-page .blog-btn-light,
.blog-page .btn.blog-btn-light {
  background: rgba(14, 124, 123);
  color: white;
  border-color: #fff;
}



/* Tagline on the image */
.blog-featured__tagline {
  position: absolute;
  right: clamp(1.25rem, 2.5vw, 2rem);
  bottom: clamp(1.25rem, 2.5vw, 1.75rem);
  z-index: 2;

  margin: 0;
  padding-bottom: 0.9rem;

  text-align: right;
  white-space: pre-line;

  font: 600 clamp(1rem, 1.5vw, 1.25rem)/1.35 var(--blog-font-heading);
  color: #fff;

  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.blog-featured__tagline::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;

  width: 2.25rem;
  height: 1px;

  background: rgba(255, 255, 255, 0.7);
}

/* ---------- 4. Toolbar: filters + search ---------- */
.blog-listing { padding: clamp(1.75rem, 3vw, 2.5rem) 0 0; }

.blog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.blog-chip {
  padding: 0.65rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(170, 210, 197, 0.07);
  color: var(--blog-green-900);
  font: 600 0.8rem/1 var(--blog-font-body);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.blog-chip:hover { background: rgbargba(14, 124, 123); }
.blog-chip[aria-pressed="true"] { background:rgba(14, 124, 123); color: #fff; }
/* ---------- Search ---------- */

.blog-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;

  flex: 0 0 auto;
  width: min(100%, 14.5rem);

  padding: 0 1rem;

  border: 1px solid var(--blog-line);
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.7);
  color: var(--blog-green-900);

  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.blog-search:focus-within {
  border-color: var(--blog-green-500);
  background: #fff;

  box-shadow:
    0 0 0 2px rgba(0, 56, 58, 0.08);
}

.blog-search svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.blog-search input {
  width: 100%;
  min-width: 0;

  padding: 0.75rem 0;

  border: 0;
  outline: none;

  background: transparent;
  color: var(--blog-ink);

  font:
    400 0.875rem/1.2
    var(--blog-font-body);
}

.blog-search input:focus {
  outline: none;
  box-shadow: none;
}

.blog-search input:focus-visible {
  outline: none;
  box-shadow: none;
}

.blog-search input::placeholder {
  color: var(--blog-muted);
}

/* ---------- 5. Card grid ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.1rem, 2vw, 1.5rem);
}

.blog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--blog-radius);
  background: #fff;
  box-shadow: var(--blog-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--blog-shadow-lift); }
.blog-card:focus-within { box-shadow: var(--blog-shadow-lift); }

.blog-card__media {
  position: relative;
  aspect-ratio: 5 / 2;
  overflow: hidden;
  background: linear-gradient(135deg, var(--blog-green-100), var(--blog-green-200));
}
.blog-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.blog-card:hover .blog-card__img { transform: scale(1.04); }

/* Branded placeholder while an image file doesn't exist yet */
.blog-card__media.is-missing::after,
.article-figure.is-missing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%230a3d2e' stroke-opacity='.35' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M9 39C9 22 20 10 40 8C39 28 28 39 9 39Z'/%3E%3Cpath d='M9 39C16 29 24 21 33 15'/%3E%3C/svg%3E") center / 2.75rem no-repeat;
}
.blog-card__media.is-missing .blog-card__img { display: none; }

.blog-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1rem 1.25rem 1.25rem;
}

.blog-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.6rem;
  font: 600 0.68rem/1.2 var(--blog-font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blog-green-700);
}
.blog-card__date { color: var(--blog-muted); letter-spacing: 0.02em; text-transform: none; font-weight: 500; }

.blog-card__title {
  margin: 0 0 0.6rem;
  font: 700 1.1rem/1.32 var(--blog-font-heading);
  letter-spacing: -0.01em;
  color: var(--blog-green-900);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__excerpt {
  flex: 1;
  margin: 0 0 1rem;
  font: 400 0.875rem/1.6 var(--blog-font-body);
  color: var(--blog-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  align-self: flex-start;
  font: 700 0.85rem/1 var(--blog-font-heading);
  color: var(--blog-green-900);
  text-decoration: none;
}
.blog-card__link svg { width: 14px; height: 14px; transition: transform 0.25s ease; }
.blog-card:hover .blog-card__link svg { transform: translateX(4px); }
/* Makes the whole card clickable with a single link */
.blog-card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.blog-card__link:focus-visible { outline: none; }
.blog-card:has(.blog-card__link:focus-visible) { outline: 2px solid var(--blog-green-500); outline-offset: 3px; }

/* Page-load entrance for cards; runs once per render, not on scroll */
@media (prefers-reduced-motion: no-preference) {
  .blog-card,
  .blog-promo {
    animation: blog-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--i, 0) * 55ms);
  }
  @keyframes blog-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }
}

/* Cell that closes the grid */
.blog-promo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  border-radius: var(--blog-radius);
  background: var(--blog-sand);
  text-align: center;
}
.blog-promo__leaf { width: 3rem; height: 3rem; margin-bottom: 1rem; color: var(--blog-green-500); }
.blog-promo__title {
  margin: 0 0 0.75rem;
  font: 700 clamp(1.35rem, 2vw, 1.7rem)/1.25 var(--blog-font-heading);
  letter-spacing: -0.015em;
  color: var(--blog-green-900);
}
.blog-promo__text {
  margin: 0 0 1.5rem;
  max-width: 26ch;
  font: 400 0.9rem/1.6 var(--blog-font-body);
  color: var(--blog-muted);
}

/* Empty search state */
.blog-empty {
  padding: clamp(2.5rem, 6vw, 4rem) 1rem;
  border-radius: var(--blog-radius);
  background: var(--blog-sand);
  text-align: center;
}
.blog-empty__title { margin: 0 0 0.4rem; font: 700 1.25rem/1.3 var(--blog-font-heading); color: var(--blog-green-900); }
.blog-empty__text { margin: 0 0 1.25rem; font: 400 0.95rem/1.6 var(--blog-font-body); color: var(--blog-muted); }
/* ---------- Blog content background texture ---------- */

.blog-content-bg {
  position: relative;
  padding-bottom: clamp(3rem, 6vw, 4.5rem);

  background-color: var(--blog-paper);
  background-image: url("../assets/images/blog/blog-bg.png");
  background-repeat: repeat-y;
  background-position: center top;
  background-size: 100% auto;
}
/* ---------- 6. Closing CTA band (also used on the article page) ---------- */
.blog-cta {
  position: relative;
  overflow: hidden;
  margin-top: 0;
  background: linear-gradient(
    105deg,
    var(--blog-green-950) 0%,
    var(--blog-green-900) 55%,
    #0e4a38 100%
  );
  color: #fff;
}
.blog-cta__art {
  position: absolute;
  inset: 0;
  z-index: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center center;

  opacity: 1;
  pointer-events: none;
}

.blog-cta__inner {
  position: relative;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;

  padding-top: clamp(2.5rem, 5vw, 3.75rem);
  padding-bottom: clamp(2.5rem, 5vw, 3.75rem);
}
.blog-cta__title {
  margin: 0 0 0.5rem;
  font: 700 clamp(1.4rem, 2.5vw, 2rem)/1.2 var(--blog-font-heading);
  letter-spacing: -0.015em;
  color: #fff;
}
.blog-cta__text { margin: 0; max-width: 46ch; font: 400 0.95rem/1.6 var(--blog-font-body); color: rgba(255, 255, 255, 0.85); }
.blog-cta .btn { flex: none; }

/* ---------- 7. Responsive ---------- */
@media (max-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-hero__tagline { display: none; }
}

@media (max-width: 900px) {
  .blog-toolbar { flex-direction: column; align-items: stretch; }
  .blog-search { order: -1; width: 100%; }

  /* Chips become a single swipeable row instead of wrapping into a wall */
  .blog-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 4px;
    margin: -4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .blog-filters::-webkit-scrollbar { display: none; }
  .blog-chip { scroll-snap-align: start; }
}

@media (max-width: 768px) {

  .blog-featured__card {
    min-height: 34rem;
  }

  .blog-featured__media {
    position: absolute;
    inset: 0;
    min-height: 100%;
  }

  .blog-featured__media img {
    object-position: 60% center;
    
  }

  .blog-featured__content {
    width: 100%;
    min-height: 34rem;
    padding: 2rem 1.5rem;

    justify-content: flex-end;

    background: transparent;
  }
  .blog-featured__content {
  width: 100%;
  min-height: 34rem;
  padding: 2rem 1.5rem 2.5rem;
  align-items: flex-start;
  justify-content: flex-end;
  background: transparent;
}

.blog-featured__label,
.blog-featured__title,
.blog-featured__excerpt,
.blog-featured__content .btn {
  margin-left: 0;
  margin-right: 0;
}

.blog-featured__tagline {
  display: none;
}

}

@media (max-width: 640px) {

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

  .blog-card__media {
    aspect-ratio: 16 / 9;
  }

  .blog-hero__topics {
    gap: 1.1rem;
  }

  .blog-hero__topics span + span::before {
    margin-right: 1.1rem;
  }

  /* Mobile CTA */
  .blog-cta__inner {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1.5rem;
  }

  .blog-cta__text {
    width: 100%;
    max-width: 30ch;
    text-align: left;
  }

  .blog-cta .btn {
    width: auto;
    align-self: center;
    min-width: 190px;
    justify-content: center;
  }

  .blog-promo .btn {
    width: 100%;
    justify-content: center;
  }
}
