/* ==========================================================================
   Harrasteblogi Related Posts — Dark UI v3.0
   Pääväri:   #d6111e (punainen)
   Aksentti:  #ddc76d (kulta)
   Tumma:     #000000
   Vaalea:    #ffffff
   ========================================================================== */

:root {
  --hb-primary:        #d6111e;
  --hb-primary-light:  #ff2d3d;
  --hb-primary-dark:   #8e0c15;
  --hb-accent:         #ddc76d;
  --hb-accent-dark:    #b89f4a;
  --hb-black:          #000000;
  --hb-white:          #ffffff;

  --hb-text:           #ffffff;
  --hb-text-muted:     #b9b9b9;

  --hb-bg-wrapper:     #000000;
  --hb-bg-card:        #0d0d0d;
  --hb-bg-card-hover:  #131313;
  --hb-bg-placeholder: #111111;

  --hb-border:         #262626;
  --hb-border-strong:  #3a3a3a;

  --hb-shadow:         0 20px 50px rgba(0, 0, 0, 0.6);
  --hb-shadow-hover:   0 0 0 1px var(--hb-primary), 0 18px 45px rgba(214, 17, 30, 0.35);
  --hb-glow-accent:    0 0 0 1px var(--hb-accent), 0 18px 45px rgba(221, 199, 109, 0.25);

  --hb-radius-lg:      20px;
  --hb-radius-md:      14px;
  --hb-radius-full:    999px;

  --hb-transition:     0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tumma teema on aina käytössä — ei vaaleaa vaihtoehtoa */

/* --------------------------------------------------------------------------
   Wrapper
   -------------------------------------------------------------------------- */

.hb-related-wrapper {
  margin: 56px 0 24px;
  padding: 36px;
  border-radius: var(--hb-radius-lg);
  background:
    radial-gradient(circle at 0% 0%, rgba(214, 17, 30, 0.10) 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(221, 199, 109, 0.06) 0%, transparent 50%),
    var(--hb-bg-wrapper);
  border: 1px solid var(--hb-border-strong);
  box-shadow: var(--hb-shadow);
  position: relative;
  overflow: hidden;
}

/* Korostusviiva ylälaidassa */
.hb-related-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--hb-primary) 0%, var(--hb-accent) 50%, var(--hb-primary) 100%);
  background-size: 200% 100%;
  animation: hbGradientShift 6s ease infinite;
  z-index: 1;
}

@keyframes hbGradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --------------------------------------------------------------------------
   Otsikkorivi
   -------------------------------------------------------------------------- */

.hb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hb-border);
  position: relative;
}

.hb-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--hb-white);
  line-height: 1.2;
}

.hb-heading::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hb-accent);
  margin-left: 2px;
}

.hb-icon {
  font-size: 1.05em;
  filter: drop-shadow(0 0 10px rgba(214, 17, 30, 0.6));
}

.hb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2em;
  padding: 7px 16px;
  border-radius: var(--hb-radius-full);
  background: var(--hb-primary);
  color: var(--hb-white);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(214, 17, 30, 0.45);
}

/* --------------------------------------------------------------------------
   Grid & kortit
   -------------------------------------------------------------------------- */

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

.hb-card {
  background: var(--hb-bg-card);
  border: 1px solid var(--hb-border);
  border-radius: var(--hb-radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--hb-transition),
              box-shadow var(--hb-transition),
              border-color var(--hb-transition),
              background var(--hb-transition);
}

.hb-card:hover,
.hb-card:focus-within {
  background: var(--hb-bg-card-hover);
  transform: translateY(-6px);
  box-shadow: var(--hb-shadow-hover);
  border-color: var(--hb-primary);
}

/* Kuvat */
.hb-thumb-link {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--hb-bg-placeholder);
  position: relative;
}

.hb-thumb-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}

.hb-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease, filter 0.5s ease;
  filter: saturate(0.92) brightness(0.92);
}

.hb-card:hover .hb-thumb {
  transform: scale(1.07);
  filter: saturate(1.05) brightness(1);
}

.hb-thumb--placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background:
    linear-gradient(135deg, rgba(221, 199, 109, 0.18) 0%, rgba(214, 17, 30, 0.28) 100%),
    var(--hb-bg-placeholder);
  border-bottom: 1px solid var(--hb-border);
}

/* Sisältö */
.hb-content {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.hb-title {
  margin: 0 0 10px;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

.hb-title a {
  color: var(--hb-white);
  text-decoration: none;
  background-image: linear-gradient(var(--hb-accent), var(--hb-accent));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 2px;
  transition: background-size var(--hb-transition), color var(--hb-transition);
}

.hb-title a:hover,
.hb-title a:focus-visible {
  background-size: 100% 2px;
  color: var(--hb-accent);
}

.hb-excerpt {
  margin: 0 0 18px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--hb-text-muted);
  flex: 1;
}

/* Lue lisää -painike */
.hb-readmore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 11px 20px;
  border-radius: var(--hb-radius-full);
  text-decoration: none;
  color: var(--hb-white) !important;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  background: var(--hb-primary);
  border: 1px solid var(--hb-primary);
  transition: background var(--hb-transition), color var(--hb-transition),
              transform var(--hb-transition), border-color var(--hb-transition),
              box-shadow var(--hb-transition);
}

.hb-readmore:hover,
.hb-readmore:focus-visible {
  background: var(--hb-accent);
  border-color: var(--hb-accent);
  color: var(--hb-black) !important;
  transform: translateX(2px);
  box-shadow: 0 6px 18px rgba(221, 199, 109, 0.35);
}

.hb-arrow {
  transition: transform var(--hb-transition);
}

.hb-readmore:hover .hb-arrow,
.hb-readmore:focus-visible .hb-arrow {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Saavutettavuus
   -------------------------------------------------------------------------- */

.hb-related-wrapper a:focus-visible {
  outline: 3px solid var(--hb-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .hb-related-wrapper::before,
  .hb-card,
  .hb-thumb,
  .hb-title a,
  .hb-readmore,
  .hb-arrow {
    animation: none !important;
    transition: none !important;
  }
}

/* --------------------------------------------------------------------------
   Responsiivisuus
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .hb-related-wrapper {
    padding: 24px 18px;
    margin: 40px 0 16px;
    border-radius: var(--hb-radius-md);
  }

  .hb-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .hb-heading {
    font-size: 1.18rem;
  }
}

@media (min-width: 481px) and (max-width: 640px) {
  .hb-related-wrapper {
    padding: 24px 18px;
    margin: 40px 0 16px;
    border-radius: var(--hb-radius-md);
  }

  .hb-grid {
    gap: 16px;
  }

  .hb-heading {
    font-size: 1.18rem;
  }
}

/* Tulostus */
@media print {
  .hb-related-wrapper {
    display: none;
  }
}
