/* =============================
   IB Tools — Category Archive
   ============================= */

body.tax-tool_category .site-content,
body.tax-tool_tag .site-content {
  background: #f9fafb; /* light neutral bg */
  padding: 2rem 1rem;
}

body.tax-tool_category .page-title,
body.tax-tool_tag .page-title {
  font-size: clamp(1.8rem, 2.5vw, 2.2rem);
  font-weight: 700;
  color: var(--ib-brand-ink, #073b4c);
  margin-bottom: 0.5rem;
  text-align: center;
}

body.tax-tool_category .archive-description,
body.tax-tool_tag .archive-description {
  font-size: 1rem;
  color: var(--ib-muted, #555);
  max-width: 720px;
  margin: 0 auto 2rem;
  text-align: center;
  line-height: 1.6;
}

/* Tool grid cards */
body.tax-tool_category .ib-tools__grid,
body.tax-tool_tag .ib-tools__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

/* Card styling (same as Tools archive) */
body.tax-tool_category .ib-card,
body.tax-tool_tag .ib-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 4px 8px rgba(0,0,0,.06);
  transition: transform .2s ease, box-shadow .2s ease;
  text-decoration: none;
  color: var(--ib-neutral-800, #222);
}

body.tax-tool_category .ib-card:hover,
body.tax-tool_tag .ib-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}

/* Card icon */
body.tax-tool_category .ib-card__icon,
body.tax-tool_tag .ib-card__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

/* Card title */
body.tax-tool_category .ib-card__title,
body.tax-tool_tag .ib-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

/* Card subtitle */
body.tax-tool_category .ib-card__sub,
body.tax-tool_tag .ib-card__sub {
  font-size: 0.95rem;
  color: var(--ib-muted, #666);
  line-height: 1.4;
}

/* Responsive spacing */
@media (max-width: 640px) {
  body.tax-tool_category .site-content,
  body.tax-tool_tag .site-content {
    padding: 1.5rem 1rem;
  }
}

/* ===== IB Tools — Taxonomy & Archive Grid ===== */

.ib-tools {
  padding: 2rem 1rem;
}

.ib-tools__head h1 {
  font-size: clamp(1.8rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--ib-brand-ink, #073B4C);
  margin: 0 0 .25rem 0;
  text-align: center;
}
.ib-tools__head .muted {
  color: var(--ib-neutral-500, #64748B);
  text-align: center;
  max-width: 56ch;
  margin: 0 auto;
}

.ib-tools__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Card */
.ib-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  background: #fff;
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
  transition: transform .18s ease, box-shadow .18s ease;
  color: var(--ib-neutral-800, #1E293B);
}
.ib-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,.09);
}

/* Media (image or emoji) */
.ib-card__media {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: var(--ib-neutral-100, #F1F5F9);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: .75rem;
}
.ib-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ib-card__icon { font-size: 2rem; }

/* Title & sub */
.ib-card__title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ib-brand-ink, #073B4C);
  text-align: center;
  margin-bottom: .25rem;
}
.ib-card__sub {
  font-size: .95rem;
  color: var(--ib-neutral-600, #475569);
  text-align: center;
  min-height: 2.4em; /* keep heights even */
}

/* CTA chip */
.ib-card__cta {
  margin-top: .75rem;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  background: var(--ib-primary, #118AB2);
  padding: .35rem .7rem;
  border-radius: 999px;
}

/* Pagination tidy */
.navigation.pagination {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0 0;
}
.navigation.pagination .page-numbers {
  display: inline-block;
  margin: 0 .25rem;
  padding: .4rem .7rem;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.navigation.pagination .page-numbers.current {
  background: var(--ib-primary, #118AB2);
  color: #fff;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .ib-tools { background: var(--ib-neutral-50, #0F172A); }
  .ib-card { background: var(--ib-neutral-100, #1E293B); }
  .ib-card__sub { color: var(--ib-neutral-500, #94A3B8); }
}

/* Badges (categories) */
.ib-card__badges {
  display: flex;
  gap: .35rem;
  margin-bottom: .35rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ib-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .5rem;
  border-radius: 999px;
  background: var(--ib-neutral-100, #F1F5F9);
  color: var(--ib-neutral-700, #334155);
  border: 1px solid var(--ib-neutral-200, #E2E8F0);
}

.ib-badge svg {
  fill: var(--ib-primary, #118AB2);
}

@media (prefers-color-scheme: dark) {
  .ib-badge {
    background: var(--ib-neutral-100, #1E293B);
    color: var(--ib-neutral-700, #E2E8F0);
    border-color: var(--ib-neutral-300, #475569);
  }
}

/* ========== IB Tools Grid & Card ========== */

/* Constrain and center the tools area */
.ib-tools {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* True responsive grid */
.ib-tools__grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

/* Make sure Astra/WP wrappers don't break our grid */
.ib-tools__grid > * { margin: 0 !important; }

/* Card */
.ib-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  background: #fff;
  border-radius: 16px;
  padding: 0.9rem;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
  transition: transform .18s ease, box-shadow .18s ease;
  color: var(--ib-neutral-800, #1E293B);
}
.ib-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,.09);
}

/* Media area with overlay badge */
.ib-card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: var(--ib-neutral-100, #F1F5F9);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: .75rem;
}
.ib-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Corner badge (RTL-aware: inset-inline-* respects dir) */
.ib-card__badge {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;       /* right in LTR, left in RTL */
  background: color-mix(in srgb, var(--ib-primary, #118AB2) 92%, #000 0%);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .25rem .55rem;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(0,0,0,.18);
  pointer-events: none;        /* badge is decorative; card is the link */
}

/* Title & sub */
.ib-card__title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ib-brand-ink, #073B4C);
  text-align: center;
  margin-bottom: .25rem;
}
.ib-card__sub {
  font-size: .95rem;
  color: var(--ib-neutral-600, #475569);
  text-align: center;
  min-height: 2.4em; /* keep card heights even across rows */
}

/* CTA chip */
.ib-card__cta {
  margin-top: auto;            /* push CTA to bottom for equal heights */
  align-self: center;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  background: var(--ib-primary, #118AB2);
  padding: .35rem .7rem;
  border-radius: 999px;
}

/* Pagination tidy */
.navigation.pagination {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0 0;
}
.navigation.pagination .page-numbers {
  display: inline-block;
  margin: 0 .25rem;
  padding: .4rem .7rem;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.navigation.pagination .page-numbers.current {
  background: var(--ib-primary, #118AB2);
  color: #fff;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  .ib-card { background: var(--ib-neutral-100, #1E293B); }
  .ib-card__sub { color: var(--ib-neutral-500, #94A3B8); }
}

/* Make entire card still feel clickable (hover effect on article) */
.ib-card { position: relative; }
.ib-card:hover { transform: translateY(-3px); }

/* Title link styling */
.ib-card__title { margin: .15rem 0 .25rem; text-align: center; }
.ib-card__titlelink {
  color: var(--ib-brand-ink, #073B4C);
  text-decoration: none;
}
.ib-card__titlelink:hover,
.ib-card__titlelink:focus {
  text-decoration: underline;
  outline: none;
}

/* CTA button as a link */
.ib-card__actions { display: grid; place-items: center; margin-top: .5rem; }
.ib-card__cta {
  display: inline-block;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  background: var(--ib-primary, #118AB2);
  padding: .35rem .7rem;
  border-radius: 999px;
  text-decoration: none;
}

/* Corner badge becomes a clickable link */
.ib-card__badge {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px; /* RTL-aware: right in LTR, left in RTL */
  background: color-mix(in srgb, var(--ib-primary, #118AB2) 92%, #000 0%);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .25rem .55rem;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(0,0,0,.18);
  text-decoration: none;
}
.ib-card__badge:hover,
.ib-card__badge:focus { filter: brightness(0.95); outline: none; }