/* ==========================================================================
   Bento Hero & Post Card Component Styles
   Ported & enhanced from Astro:
     - Clear, vivid, high-clarity images when out of focus
     - Darker cinematic tint & zoom on hover
     - Category tags removed from preview cards
   ========================================================================== */

/* ── Bento Hero Section ─────────────────────────────────────────────────── */

.bento {
  padding-block: 1.5rem 0;
}

.bento__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 52rem) {
  .bento__grid {
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: auto;
  }
}

/* Side stack: two cards in a column */
.bento__side {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
}

/* ── Shared Bento Card Shell ────────────────────────────────────────────── */

.bento-card {
  position: relative;
  overflow: hidden;
  background: var(--chrome-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.bento-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 56, 255, 0.4);
  border-color: rgba(0, 56, 255, 0.5);
}

/* Hero card: taller on desktop */
.bento-card--hero {
  aspect-ratio: 4 / 3;
}

@media (min-width: 52rem) {
  .bento-card--hero {
    aspect-ratio: unset;
    min-height: 480px;
  }
}

/* Side cards: shorter */
.bento-card--side {
  aspect-ratio: 16 / 9;
}

@media (min-width: 52rem) {
  .bento-card--side {
    aspect-ratio: unset;
  }
}

.bcard__link {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: inherit;
  text-decoration: none;
  color: #fff;
  overflow: hidden;
}

/* ── Bento Image (Bright out-of-focus, darker on hover) ─────────────────── */

.bcard__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Out of focus: bright, vivid, crystal clear */
  filter: brightness(1) contrast(1.02);
  transition: transform 5s cubic-bezier(0.1, 1, 0.1, 1), filter 0.35s ease;
}

/* Hover / focus: image darkens slightly for dramatic contrast with text */
.bcard__link:hover .bcard__img,
.bcard__link:focus-visible .bcard__img {
  transform: scale(1.05);
  filter: brightness(0.78) contrast(1.08);
}

.bcard__blank {
  position: absolute;
  inset: 0;
  background-color: #0b0f17;
  background-image:
    radial-gradient(ellipse at 80% 15%, rgba(0, 56, 255, 0.22), transparent 55%),
    radial-gradient(ellipse at 15% 85%, rgba(0, 163, 255, 0.12), transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
}

/* ── Bento Scrim (Soft bottom gradient at rest, deeper dark on hover) ──── */

.bcard__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Out of focus: completely clear at top & mid; gentle gradient at bottom behind text */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.42) 32%,
    rgba(0, 0, 0, 0.08) 55%,
    transparent 72%
  );
  transition: background 0.35s ease, opacity 0.35s ease;
}

/* On hover: deepens to cinematic dark tint for the revealed description */
.bcard__link:hover .bcard__scrim,
.bcard__link:focus-visible .bcard__scrim {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.94) 0%,
    rgba(0, 0, 0, 0.72) 48%,
    rgba(0, 0, 0, 0.38) 100%
  );
}

/* ── Bento Always-visible bottom strip (title + author) ─────────────────── */

.bcard__always {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 1.5rem 1.35rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.bcard__link:hover .bcard__always,
.bcard__link:focus-visible .bcard__always {
  transform: translateY(-4.2rem);
}

.bento-card--side .bcard__link:hover .bcard__always,
.bento-card--side .bcard__link:focus-visible .bcard__always {
  transform: translateY(-3.4rem);
}

.bcard__title {
  margin: 0;
  font-size: clamp(1.15rem, 2.3vw, 1.7rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: var(--track-title);
  color: #fff;
  text-wrap: balance;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 2px 10px rgba(0, 0, 0, 0.55);
}

.bento-card--side .bcard__title {
  font-size: clamp(0.98rem, 1.6vw, 1.25rem);
}

.bcard__author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.bcard__avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.bcard__avatar-fb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Bento Hover-reveal panel (description + date) ──────────────────────── */

.bcard__reveal {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0 1.35rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease;
}

.bcard__link:hover .bcard__reveal,
.bcard__link:focus-visible .bcard__reveal {
  transform: translateY(0);
  opacity: 1;
}

.bcard__desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.bcard__date {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}

/* ── Tag strip / Topics ─────────────────────────────────────────────────── */

.tag-strip {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-block: 2rem 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.95rem;
  scrollbar-width: none;
}

.tag-strip::-webkit-scrollbar {
  display: none;
}

.tag-strip__label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-strip__pills {
  display: flex;
  gap: 0.55rem;
  flex-wrap: nowrap;
}

.tag-strip__pill {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.tag-strip__pill:hover,
.tag-strip__pill.is-active {
  color: var(--fg);
  border-color: var(--fg);
  background: var(--bg-sunken);
}

/* ── Post Grid (3 columns on desktop) ───────────────────────────────────── */

.post-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 62rem) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 40rem) {
  .post-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Post Card (Grid tile with hover-reveal) ────────────────────────────── */

.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 56, 255, 0.35);
  border-color: rgba(0, 56, 255, 0.4);
}

.post-card__link {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  overflow: hidden;
  background: var(--chrome-bg);
  color: #fff;
  text-decoration: none;
}

.post-card__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Post Card Thumbnail (Clear out-of-focus, darker on hover) ──────────── */

.post-card__thumb {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.post-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  /* Out of focus: clear and bright */
  filter: brightness(1) contrast(1.02);
  transition: transform 5s cubic-bezier(0.1, 1, 0.1, 1), filter 0.32s ease;
}

.post-card__link:hover .post-card__img,
.post-card__link:focus-visible .post-card__img {
  transform: scale(1.05);
  /* Hover: darkens slightly for text readability */
  filter: brightness(0.8) contrast(1.06);
}

.post-card__blank {
  position: absolute;
  inset: 0;
  background-color: #0b0f17;
  background-image:
    radial-gradient(ellipse at 80% 15%, rgba(0, 56, 255, 0.22), transparent 55%),
    radial-gradient(ellipse at 15% 85%, rgba(0, 163, 255, 0.12), transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
}

/* ── Post Card Scrim ────────────────────────────────────────────────────── */

.post-card__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Out of focus: transparent top/mid; subtle bottom gradient */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.4) 30%,
    transparent 60%
  );
  transition: background 0.32s ease;
}

.post-card__link:hover .post-card__scrim,
.post-card__link:focus-visible .post-card__scrim {
  /* On hover: darker background for description */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.68) 48%,
    rgba(0, 0, 0, 0.32) 100%
  );
}

/* ── Read-time badge ────────────────────────────────────────────────────── */

.post-card__badge {
  position: absolute;
  top: 0.75rem;
  left: 0.9rem;
  z-index: 3;
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  background: rgba(14, 19, 26, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-control);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ── Always-visible: Title + Author ─────────────────────────────────────── */

.post-card__always {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  width: 100%;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 1.35rem 1.25rem 1.15rem;
  gap: 0.45rem;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.post-grid .post-card__always {
  aspect-ratio: 3 / 2;
  min-height: unset;
}

.post-card__link:hover .post-card__always,
.post-card__link:focus-visible .post-card__always {
  transform: translateY(-3.75rem);
}

.post-card__title {
  margin: 0;
  font-size: var(--size-md);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: var(--track-title);
  text-wrap: balance;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.post-card__link:hover .post-card__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.post-card__author {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.post-card__author-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.post-card__author-fallback {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Hover-reveal panel (description + date) ────────────────────────────── */

.post-card__reveal {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0 1.25rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}

.post-card__link:hover .post-card__reveal,
.post-card__link:focus-visible .post-card__reveal {
  transform: translateY(0);
  opacity: 1;
}

.post-card__desc {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.48;
  color: rgba(255, 255, 255, 0.92);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.post-card__date {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ── Blog Page Custom Styles ────────────────────────────────────────────── */

.blog-header {
  padding-block: 3rem 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.blog-header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.blog-header__title {
  font-size: clamp(2rem, 4vw, var(--size-3xl));
  margin-bottom: 0.6rem;
  letter-spacing: var(--track-heading);
}

.blog-header__subtitle {
  font-size: var(--size-md);
  color: var(--fg-muted);
  max-width: 640px;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.blog-stats {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 1rem;
}

.blog-stat {
  display: flex;
  flex-direction: column;
}

.blog-stat__value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.1;
}

.blog-stat__label {
  font-size: var(--size-xs);
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ── Asymmetric Bento Blog Grid ─────────────────────────────────────────── */

.bento-post-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.bento-post-grid .post-card {
  height: 100%;
}

.bento-post-grid .post-card__link {
  height: 100%;
}

.bento-post-grid .post-card__always {
  aspect-ratio: unset;
  min-height: 280px;
}

/* Wide asymmetric bento cards */
.bento-post-grid .post-card--wide {
  grid-column: span 2;
}

.bento-post-grid .post-card--wide .post-card__always {
  min-height: 380px;
  aspect-ratio: unset;
  padding: 1.75rem 1.6rem 1.35rem;
}

.bento-post-grid .post-card--wide .post-card__title {
  font-size: clamp(1.2rem, 2.2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.2;
}

.bento-post-grid .post-card--wide .post-card__author {
  font-size: 0.85rem;
}

.bento-post-grid .post-card--wide:hover .post-card__always,
.bento-post-grid .post-card--wide:focus-visible .post-card__always {
  transform: translateY(-4.4rem);
}

.bento-post-grid .post-card--wide .post-card__desc {
  font-size: 0.9rem;
  line-height: 1.5;
  -webkit-line-clamp: 3;
}

@media (max-width: 62rem) {
  .bento-post-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .bento-post-grid .post-card--wide {
    grid-column: span 2;
  }
  .bento-post-grid .post-card--wide .post-card__always {
    min-height: 320px;
  }
}

@media (max-width: 42rem) {
  .bento-post-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .bento-post-grid .post-card--wide {
    grid-column: span 1;
  }
  .bento-post-grid .post-card--wide .post-card__always,
  .bento-post-grid .post-card__always {
    min-height: 250px;
    aspect-ratio: unset;
  }
}
