/* ==========================================================================
   Liittyvät artikkelit — "Dossier" v5.1 (korvaa "Harrasteblogi Related
   Posts" -lisäosan assets/css/style.css:n, sisältö käytännössä muuttamaton).
   Pääväri:   #d6111e (punainen)
   Aksentti:  #ddc76d (kulta / foliokorostus)

   Suunnitteluidea: ei tavanomainen "poster-kortti-ruudukko". Sen sijaan
   arkistomainen "dossier"-asettelu: ensimmäinen artikkeli nousee esiin
   leveänä kohokorttina, loput asettuvat tiiviiksi indeksilistaksi jossa
   jokaisella kortilla on oma haamunumero (01, 02, …) ja kultainen
   "leimattu" kulma — viittaus fyysiseen arkistokorttiin / pääsylippuun.

   Kaikki selektorit ovat omalla ".hb-related-wrapper"-nimiavaruudellaan,
   joten mitään uudelleenskoopausta ei tarvinnut tehdä sitä varten että
   site.css ladataan joka sivulla — tämä tyylitiedosto ladataan silti vain
   yksittäisen artikkelin sivuilla (ks. hb_core_related_enqueue_assets()).
   ========================================================================== */

:root {
  --hb-primary:        #d6111e;
  --hb-primary-dark:   #a30c17;
  --hb-accent:         #ddc76d;
  --hb-accent-dark:    #b89f4a;
  --hb-black:          #000000;
  --hb-white:          #ffffff;

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

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

  --hb-border:         #232323;
  --hb-border-strong:  #2e2e2e;

  --hb-shadow:         0 12px 32px rgba(0, 0, 0, 0.5);
  --hb-shadow-hover:   0 0 0 1px var(--hb-primary), 0 10px 28px rgba(0, 0, 0, 0.55);

  --hb-radius-lg:      16px;
  --hb-radius-md:      10px;
  --hb-radius-full:    999px;

  --hb-transition:     0.2s ease;

  --hb-index-color:    rgba(221, 199, 109, 0.14);
  --hb-index-color-hover: rgba(221, 199, 109, 0.26);
  --hb-fold-size:      26px;
  --hb-spot-x:         50%;
  --hb-spot-y:         50%;
}

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

.hb-related-wrapper {
  margin: 48px 0 24px;
  padding: 28px;
  border-radius: var(--hb-radius-lg);
  background-color: var(--hb-bg-wrapper) !important;
  background-image: none !important;
  border: 1px solid var(--hb-border-strong);
  box-shadow: var(--hb-shadow);
  position: relative;
  isolation: isolate;
}

.hb-related-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 2px;
  background: var(--hb-primary);
  border-radius: var(--hb-radius-full);
}

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

.hb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 26px;
  padding-top: 6px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--hb-border-strong);
  position: relative;
}

.hb-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--hb-white);
  line-height: 1.2;
}

.hb-icon {
  font-size: 1em;
  opacity: 0.9;
}

.hb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4em;
  padding: 5px 12px;
  border-radius: 4px;
  background: transparent;
  color: var(--hb-accent);
  border: 1px dashed var(--hb-accent-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

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

.hb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.hb-card {
  --hb-spot-x: 50%;
  --hb-spot-y: 50%;
  background-color: var(--hb-bg-card) !important;
  background-image: none !important;
  border: 1px solid var(--hb-border);
  border-left: 3px solid var(--hb-border-strong);
  border-radius: var(--hb-radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--hb-transition),
              box-shadow var(--hb-transition),
              border-color var(--hb-transition),
              background-color var(--hb-transition);
}

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

/* "Foliokiilto" — kultainen valokeila joka seuraa hiirtä (asetetaan
   JS:llä --hb-spot-x/--hb-spot-y -muuttujiin). Puhtaasti dekoratiivinen. */
.hb-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    220px circle at var(--hb-spot-x) var(--hb-spot-y),
    rgba(221, 199, 109, 0.10),
    transparent 70%
  );
  transition: opacity var(--hb-transition);
  z-index: 1;
}

.hb-card:hover::after,
.hb-card:focus-within::after {
  opacity: 1;
}

.hb-card article {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  z-index: 2;
}

/* Haamunumero — arkistokortin indeksi (01, 02, 03…), puhtaasti
   dekoratiivinen. */
.hb-index {
  position: absolute;
  top: 4px;
  right: 10px;
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--hb-index-color);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  transition: color var(--hb-transition);
}

.hb-card:hover .hb-index,
.hb-card:focus-within .hb-index {
  color: var(--hb-index-color-hover);
}

/* Kuvat */
.hb-thumb-link {
  display: block !important;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--hb-bg-placeholder);
  position: relative;
}

.hb-thumb-link::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 var(--hb-fold-size) var(--hb-fold-size) 0;
  border-color: transparent var(--hb-accent) transparent transparent;
  opacity: 0.92;
  filter: drop-shadow(-2px 2px 3px rgba(0, 0, 0, 0.45));
  transition: border-width var(--hb-transition);
  z-index: 2;
}

.hb-card:hover .hb-thumb-link::after,
.hb-card:focus-within .hb-thumb-link::after {
  border-width: 0 34px 34px 0;
}

.hb-thumb {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: cover !important;
  filter: grayscale(35%) contrast(1.05);
  transition: transform 0.4s ease, filter 0.4s ease;
}

.hb-card:hover .hb-thumb,
.hb-card:focus-within .hb-thumb {
  transform: scale(1.04);
  filter: grayscale(0%) contrast(1);
}

.hb-excerpt--empty {
  min-height: calc(0.88rem * 1.6 * 3);
  pointer-events: none;
}

.hb-thumb--placeholder {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--hb-bg-placeholder);
  border-bottom: 1px solid var(--hb-border);
}

.hb-placeholder-icon {
  font-size: 2rem;
  opacity: 0.3;
}

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

.hb-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
  padding-right: 2.4em;
}

.hb-title a {
  color: var(--hb-white) !important;
  text-decoration: none !important;
  transition: color var(--hb-transition);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hb-title a:hover,
.hb-title a:focus-visible {
  color: var(--hb-accent) !important;
}

.hb-excerpt {
  margin: 0 0 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--hb-text-muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hb-readmore {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 0;
  border-radius: 0;
  text-decoration: none !important;
  color: var(--hb-primary) !important;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  background: transparent !important;
  border: none;
  border-bottom: 1px solid transparent;
  transition: color var(--hb-transition), border-color var(--hb-transition);
}

.hb-readmore:hover,
.hb-readmore:focus-visible {
  color: var(--hb-accent) !important;
  border-bottom-color: var(--hb-accent);
}

.hb-arrow {
  font-size: 0.9em;
  transition: transform var(--hb-transition);
}

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

/* --------------------------------------------------------------------------
   Kohokortti (ensimmäinen artikkeli)
   -------------------------------------------------------------------------- */

.hb-card--featured {
  grid-column: 1 / -1;
  border-left-width: 4px;
  border-left-color: var(--hb-primary);
}

.hb-card--featured article {
  flex-direction: row;
  align-items: stretch;
}

.hb-card--featured .hb-thumb-link,
.hb-card--featured .hb-thumb--placeholder {
  width: 42%;
  max-width: 380px;
  aspect-ratio: auto;
  flex-shrink: 0;
}

.hb-card--featured .hb-content {
  padding: 24px 28px 24px 26px;
  justify-content: center;
}

.hb-card--featured .hb-index {
  font-size: 4.4rem;
  top: 6px;
  right: 18px;
}

.hb-card--featured .hb-title {
  font-size: 1.35rem;
  padding-right: 3.2em;
}

.hb-card--featured .hb-title a {
  -webkit-line-clamp: 3;
}

.hb-card--featured .hb-excerpt {
  font-size: 0.94rem;
  -webkit-line-clamp: 3;
}

.hb-card--featured .hb-readmore {
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .hb-card--featured article {
    flex-direction: column;
  }

  .hb-card--featured .hb-thumb-link,
  .hb-card--featured .hb-thumb--placeholder {
    width: 100%;
    max-width: none;
    aspect-ratio: 16 / 9;
  }

  .hb-card--featured .hb-index {
    font-size: 2.6rem;
  }

  .hb-card--featured .hb-title {
    font-size: 1.1rem;
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  .hb-card,
  .hb-card::after,
  .hb-thumb,
  .hb-thumb-link::after,
  .hb-title a,
  .hb-readmore,
  .hb-arrow,
  .hb-index {
    transition: none !important;
  }
}

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

@media (max-width: 640px) and (min-width: 481px) {
  .hb-related-wrapper {
    padding: 20px 16px;
    margin: 36px 0 16px;
  }

  .hb-grid {
    gap: 14px;
    grid-template-columns: repeat(2, 1fr);
  }

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

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

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

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

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

.hb-related-wrapper,
.hb-related-wrapper * {
  box-sizing: border-box;
}

.hb-related-wrapper .hb-grid,
.hb-related-wrapper .hb-grid li {
  list-style: none !important;
}

.hb-related-wrapper img.hb-thumb {
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

body .hb-related-wrapper {
  background-color: var(--hb-bg-wrapper) !important;
}

body .hb-related-wrapper .hb-card {
  background-color: var(--hb-bg-card) !important;
}

.hb-related-wrapper a {
  text-decoration: none !important;
}

.hb-related-wrapper .hb-title a {
  color: var(--hb-white) !important;
}

.hb-related-wrapper .hb-title a:hover {
  color: var(--hb-accent) !important;
}

.hb-related-wrapper .hb-readmore {
  color: var(--hb-primary) !important;
  background: transparent !important;
  border-color: transparent !important;
}

.hb-related-wrapper .hb-readmore:hover {
  color: var(--hb-accent) !important;
}

.hb-related-wrapper .hb-heading,
.hb-related-wrapper .hb-title {
  margin-top: 0 !important;
  font-family: inherit;
}

.hb-related-wrapper .hb-heading {
  color: var(--hb-white) !important;
}

.hb-related-wrapper .hb-grid {
  display: grid !important;
}

.hb-related-wrapper .hb-card {
  display: flex !important;
  float: none !important;
}

.hb-related-wrapper .hb-card--featured article {
  display: flex !important;
  flex-direction: row !important;
}

@media (max-width: 720px) {
  .hb-related-wrapper .hb-card--featured article {
    flex-direction: column !important;
  }
}

.hb-related-wrapper .hb-thumb-link {
  box-shadow: none !important;
}

.hb-related-wrapper {
  width: 100% !important;
  max-width: 100% !important;
}
