/* Titan Nova Category Cards – v1.4.7 */
.tncc-widget,
.tncc-widget * {
  box-sizing: border-box;
}

.tncc-force-full-width {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  left: 50%;
  margin-left: -50vw;
  margin-right: 0;
}

.tncc-section {
  width: 100%;
  padding: 6px 18px 16px;
  background: #ffffff;
  overflow: hidden;
}

.tncc-inner {
  width: max-content;
  max-width: min(1360px, 100%);
  margin: 0 auto;
}

.tncc-heading {
  margin: 0 0 20px;
  color: #111111;
  text-align: center;
  font-family: inherit;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.tncc-grid {
  --tncc-card-width: 400px;
  display: grid;
  grid-template-columns: repeat(3, var(--tncc-card-width));
  width: max-content;
  max-width: 100%;
  column-gap: 28px;
  row-gap: 28px;
  justify-items: start;
  align-items: stretch;
}

/* Large default card that matches the provided reference look. */
.tncc-card {
  position: relative;
  isolation: isolate;
  width: var(--tncc-card-width);
  max-width: var(--tncc-card-width);
  height: 488px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0 solid transparent;
  border-radius: 0;
  background: #111111;
  box-shadow: none;
  transform: translateY(0);
  transition: transform .28s ease, box-shadow .28s ease;
}

/* AUTO IMAGE FILL: no empty black area appears when card height is changed */
.tncc-auto-image-fill .tncc-image-wrap {
  position: relative;
  flex: 1 1 auto !important;
  width: 100%;
  height: auto !important;
  min-height: 0;
  overflow: hidden;
  background: #efefef;
}

/* Manual mode remains available in Elementor for custom image heights */
.tncc-manual-image-height .tncc-image-wrap {
  position: relative;
  flex: 0 0 328px;
  width: 100%;
  height: 328px;
  overflow: hidden;
  background: #efefef;
}

.tncc-image-wrap img,
.tncc-card-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center center;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0) scale(1.001);
  transition: transform .45s ease;
}

.tncc-card:hover .tncc-image-wrap img {
  transform: translateZ(0) scale(1.055);
}


/* The transparent overlay makes image, title and black panel open the same URL as the CTA. */
.tncc-card-overlay-link {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: block;
  cursor: pointer;
}

.tncc-card--linked .tncc-button {
  z-index: 6;
  pointer-events: auto;
}

.tncc-card--linked:focus-within {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/*
 * The diagonal accent belongs to the black content panel, never to the image.
 * It sits inside the black panel and visually matches the reference card.
 */
.tncc-stripe {
  position: absolute;
  z-index: 0;
  top: -2px;
  bottom: auto;
  left: -3%;
  display: block;
  width: 110%;
  height: 32px;
  background: #f30b1d;
  transform: rotate(8deg);
  transform-origin: left top;
  pointer-events: none;
}

.tncc-card-body {
  position: relative;
  isolation: auto;
  flex: 0 0 160px;
  width: 100%;
  min-height: 0;
  height: 160px;
  padding: 46px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 22px;
  overflow: hidden;
  background: #111111;
}

/* Keep the readable text and CTA above the decorative stripe. */
.tncc-card-title,
.tncc-button {
  position: relative;
  z-index: 1;
}

.tncc-card-title {
  width: 100%;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-family: inherit;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: clip;
  white-space: normal;
  text-transform: uppercase;
}

.tncc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 4px;
  background: #f30b1d;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease, transform .2s ease;
}

.tncc-button:hover {
  background: #ffffff;
  color: #111111;
  transform: translateY(-1px);
}

@media (max-width: 1024px) {
  .tncc-section {
    padding: 18px 22px 28px;
  }

  .tncc-inner {
    width: max-content;
    max-width: 100%;
  }

  .tncc-grid {
    --tncc-card-width: 320px;
    grid-template-columns: repeat(2, var(--tncc-card-width));
    justify-items: center;
    column-gap: 20px;
    row-gap: 22px;
  }

  .tncc-card {
    width: var(--tncc-card-width);
    max-width: var(--tncc-card-width);
    height: 404px;
  }

  .tncc-card-body {
    flex-basis: 126px;
    height: 126px;
    padding: 36px 14px 16px;
    gap: 16px;
  }

  .tncc-manual-image-height .tncc-image-wrap {
    flex-basis: 278px;
    height: 278px;
  }

  .tncc-card-title {
    font-size: 17px;
  }

  .tncc-button {
    padding: 12px 14px;
    font-size: 12px;
  }
}

@media (max-width: 767px) {
  /*
   * Mobile safety lock
   *
   * Elementor prints per-widget responsive styles after this stylesheet.
   * A saved desktop/tablet card width could therefore win on a phone and
   * push the title/button outside the visible area. Keep the widget itself,
   * grid and every card inside the real mobile content width.
   */
  .tncc-force-full-width {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    left: auto !important;
    right: auto !important;
    margin: 0 !important;
    transform: none !important;
  }

  .tncc-section {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 12px 12px 22px;
    overflow-x: clip;
  }

  /* One centered card per row and no horizontal scroll on phones. */
  .tncc-inner {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-right: auto !important;
    margin-left: auto !important;
  }

  .tncc-grid {
    --tncc-card-width: 100%;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    justify-items: center !important;
    justify-content: center !important;
    row-gap: 18px;
  }

  .tncc-card {
    width: min(100%, var(--tncc-card-width, 100%)) !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-right: auto !important;
    margin-left: auto !important;
  }

  /* Do not allow a theme or saved Elementor padding/transform to crop CTA text. */
  .tncc-card-body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    left: auto !important;
    right: auto !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    transform: none !important;
  }

  .tncc-image-wrap,
  .tncc-image-wrap img,
  .tncc-card-img {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .tncc-card-title,
  .tncc-button {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-wrap: anywhere;
  }

  .tncc-button {
    white-space: normal;
  }

  /*
   * Default mobile fallback. The automatic mode below provides the best
   * result on 320px–430px phone screens while still allowing manual control.
   */
  .tncc-card-body {
    flex-basis: 160px;
    height: 160px;
    padding: 46px 16px 20px;
    gap: 20px;
  }

  .tncc-manual-image-height .tncc-image-wrap {
    flex-basis: 328px;
    height: 328px;
  }

  .tncc-card-title {
    font-size: 18px;
  }

  .tncc-button {
    padding: 13px 15px;
    font-size: 13px;
  }

  /*
   * Mobile Friendly Auto Fit is enabled by default. It preserves the card
   * proportions, keeps the stripe clear of the title and scales smoothly
   * instead of cropping badly or becoming too tall on small phones.
   */
  .tncc-mobile-auto-fit .tncc-grid {
    --tncc-card-width: 100% !important;
  }

  .tncc-mobile-auto-fit .tncc-card {
    width: 100% !important;
    max-width: 100% !important;
    height: clamp(360px, calc((100vw - 24px) * 1.22), 488px) !important;
  }

  .tncc-mobile-auto-fit .tncc-card-body {
    flex-basis: clamp(132px, calc((100vw - 24px) * .40), 160px) !important;
    height: clamp(132px, calc((100vw - 24px) * .40), 160px) !important;
    padding: clamp(36px, calc((100vw - 24px) * .115), 46px) clamp(14px, calc((100vw - 24px) * .04), 16px) clamp(16px, calc((100vw - 24px) * .05), 20px) !important;
    gap: clamp(14px, calc((100vw - 24px) * .05), 20px) !important;
  }

  .tncc-mobile-auto-fit .tncc-stripe {
    top: clamp(-9px, calc((100vw - 24px) * -.025), -6px);
    height: clamp(26px, calc((100vw - 24px) * .08), 32px);
  }

  .tncc-mobile-auto-fit .tncc-card-title {
    font-size: clamp(16px, calc((100vw - 24px) * .047), 19px) !important;
  }

  .tncc-mobile-auto-fit .tncc-button {
    padding: clamp(11px, calc((100vw - 24px) * .035), 14px) clamp(13px, calc((100vw - 24px) * .04), 16px) !important;
    font-size: clamp(11px, calc((100vw - 24px) * .034), 13px) !important;
  }

  .tncc-mobile-auto-fit.tncc-manual-image-height .tncc-image-wrap {
    flex-basis: auto !important;
    height: auto !important;
  }
}
