/* ========================================================================
   KarPayı — Related Articles
   Unified horizontal carousel for all screen sizes.
   Lazy-loaded only on article pages.
   ======================================================================== */

/* ── Section ──────────────────────────────────────────────────────── */
.kp-related {
  padding: 3rem 0;
  background: var(--surface-2, #f5f5f5);
}

/* ── Section Header: title + category link ────────────────────────── */
.kp-related__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0 0.5rem;
}

@media (min-width: 992px) {
  .kp-related__header {
    padding: 0;
  }
}

.kp-related__heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-1, #1a1a1a);
}

.kp-related__hub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--primary, #0d6d3a);
  text-decoration: none;
  padding: 0.5rem 0;
  transition: color 0.2s ease, gap 0.2s ease;
}

.kp-related__hub-link:hover,
.kp-related__hub-link:focus-visible {
  color: var(--primary, #0d6d3a);
  text-decoration: underline;
  text-underline-offset: 0.25rem;
  gap: 0.625rem;
}

.kp-related__hub-link .kp-icon {
  width: 14px;
  height: 14px;
}

/* ========================================================================
   Card — shared base
   ======================================================================== */
.kp-related__card {
  display: flex;
  flex-direction: column;
  background: var(--surface-1, #fff);
  border-radius: 1rem;
  overflow: hidden;
  text-decoration: none;
  color: var(--text-1, #1a1a1a);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease;
}

.kp-related__card:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14);
  text-decoration: none;
  color: var(--text-1, #1a1a1a);
}

/* ── Card Header: Title + Eye icon ──────────────────────────────── */
.kp-related__card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 0.5rem;
}

.kp-related__card-title {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 992px) {
  .kp-related__card-title {
    font-size: 1.25rem;
  }
}

.kp-related__card-eye {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary, #0d6d3a);
  color: #fff;
}

.kp-related__card-eye .kp-icon {
  width: 18px;
  height: 18px;
}

/* ── Card focus-visible (a11y) ──────────────────────────────────── */
.kp-related__card:focus-visible {
  outline: 2px solid var(--primary, #0d6d3a);
  outline-offset: 2px;
}

/* ========================================================================
   Hero variant — image-bearing card with editorial overlay
   - Image fills the top, fixed 16:9 aspect ratio (CLS-safe).
   - Title overlays bottom-left over a dark gradient (readable, white).
   - Action chip floats top-right over the image.
   - Card body (meta, desc, CTA) stays below; gray meta bar dropped.
   ======================================================================== */
.kp-related__hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2, #f5f5f5);
  isolation: isolate;
}

.kp-related__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kp-related__hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.45) 30%,
    rgba(0, 0, 0, 0) 60%
  );
  pointer-events: none;
  z-index: 1;
}

.kp-related__hero-title {
  position: absolute;
  left: 1rem;
  right: 3.5rem;
  bottom: 0.875rem;
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  z-index: 2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

@media (min-width: 992px) {
  .kp-related__hero-title {
    font-size: 1.1875rem;
    bottom: 1rem;
    -webkit-line-clamp: 2;
  }
}

.kp-related__hero-action {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-1, #1a1a1a);
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: background 0.2s ease, color 0.2s ease;
}

.kp-related__hero-action .kp-icon {
  width: 16px;
  height: 16px;
}

.kp-related__card--has-hero:hover .kp-related__hero-action,
.kp-related__card--has-hero:focus-visible .kp-related__hero-action {
  background: var(--primary, #0d6d3a);
  color: #fff;
}

/* Hero-variant body: meta is a compact muted strip glued to the hero
   image, edge-to-edge, no radius — separates image from the white
   description/CTA body below. */
.kp-related__card--has-hero .kp-related__card-meta {
  background: var(--surface-2, #f5f5f5);
  margin: 0;
  padding: 0.625rem 1.25rem;
  border-radius: 0;
}

.kp-related__card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 1.25rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-2, #666);
  background: var(--surface-2, #f5f5f5);
  border-radius: 0 0 0.75rem 0.75rem;
}

/* When no image, meta gets full rounded corners */
.kp-related__card-header + .kp-related__card-meta {
  margin-top: 0.5rem;
  border-radius: 0.75rem;
}

.kp-related__card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.kp-related__card-meta .kp-icon-sm {
  width: 14px;
  height: 14px;
}

/* ── Card Description ───────────────────────────────────────────── */
.kp-related__card-desc {
  padding: 0.5rem 1.25rem 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-2, #666);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Card Link ──────────────────────────────────────────────────── */
.kp-related__card-link {
  padding: 0.75rem 1.25rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary, #0d6d3a);
  margin-top: auto;
}

.kp-related__card:hover .kp-related__card-link {
  text-decoration: underline;
}

/* ========================================================================
   Carousel — unified for all screen sizes
   ======================================================================== */
.kp-related__carousel {
  position: relative;
}

@media (min-width: 768px) {
  .kp-related__carousel {
    padding: 0 3rem;
  }
}

/* ── Track base ──────────────────────────────────────────────────── */
.kp-related__track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 10%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;       /* Firefox */
  padding-bottom: 0.25rem;     /* prevent shadow clipping */
}

.kp-related__track::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
}

/* ── Mobile (<768px): 1 centered card, neighbors peek ────────────── */
.kp-related__track .kp-related__card {
  flex: 0 0 75%;
  scroll-snap-align: center;
}

/* ── Small tablet (768–991px): 2 cards visible, GSAP carousel ────── */
@media (min-width: 768px) {
  .kp-related__track {
    gap: 1.25rem;
    overflow: hidden;
    cursor: grab;
  }

  .kp-related__track:active {
    cursor: grabbing;
  }

  .kp-related__track .kp-related__card {
    flex: 0 0 calc(50% - 0.625rem);
  }
}

/* ── Large tablet / desktop (≥992px): 3 cards visible ────────────── */
@media (min-width: 992px) {
  .kp-related__track .kp-related__card {
    flex: 0 0 calc(33.333% - 0.833rem);
  }
}

/* ── Nav Arrows — desktop only, show on hover ────────────────────── */
.kp-related__nav {
  display: none;
}

@media (min-width: 768px) {
  .kp-related__nav {
    display: flex;
    position: absolute;
    top: calc(50% - 30px);
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border, #e5e5e5);
    background: var(--surface-1, #fff);
    color: var(--text-1, #1a1a1a);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 2;
    opacity: 0;
    transition: box-shadow 0.15s, opacity 0.25s;
  }

  .kp-related__carousel:hover .kp-related__nav {
    opacity: 1;
  }

  .kp-related__nav:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  }
}

.kp-related__nav .kp-icon {
  width: 18px;
  height: 18px;
}

.kp-related__nav--prev {
  left: 0;
}

.kp-related__nav--next {
  right: 0;
}

/* ── Dot Indicators ──────────────────────────────────────────────── */
.kp-related__dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.kp-related__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--text-3, #ccc);
  opacity: 0.35;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s, background 0.2s, transform 0.2s;
}

.kp-related__dot.is-active,
.kp-related__dot[aria-current="true"] {
  opacity: 1;
  background: var(--primary, #0d6d3a);
  transform: scale(1.2);
}

.kp-related__dot:focus-visible {
  outline: 2px solid var(--primary, #0d6d3a);
  outline-offset: 2px;
}

/* ── Reduced Motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .kp-related__card,
  .kp-related__hub-link,
  .kp-related__hero-action,
  .kp-related__nav,
  .kp-related__dot {
    transition: none;
  }
  .kp-related__dot.is-active,
  .kp-related__dot[aria-current="true"] {
    transform: none;
  }
}

/* ========================================================================
   Dark Mode
   ======================================================================== */
[data-theme="dark"] .kp-related {
  background: var(--surface-2, #111);
}

[data-theme="dark"] .kp-related__card {
  background: var(--surface-1, #1a1a1a);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .kp-related__card:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .kp-related__card-eye {
  background: var(--primary, #2ea85a);
}

[data-theme="dark"] .kp-related__hub-link {
  color: var(--primary, #2ea85a);
}

[data-theme="dark"] .kp-related__card-meta {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-3, #999);
}

[data-theme="dark"] .kp-related__hero-action {
  background: rgba(26, 26, 26, 0.88);
  color: #e5e5e5;
}

[data-theme="dark"] .kp-related__nav {
  background: var(--surface-1, #1a1a1a);
  border-color: var(--border, #333);
  color: #e5e5e5;
}
