/*
 * TE v4 – Sporttudomány Blog (com_content kategória és cikk "teblog" layout)
 * author: Laszlo BLAHO – www.blaho.hu
 *
 * A v3 _blog.scss utódja, natív CSS-beágyazással. A blog saját arculata megmarad
 * (kör alakú áttűnés a kékbe, vonalikonos réteg, saját kártya), a v4-hez hangolva:
 *   - a sáv alacsonyabb: clamp(240px, 20vw, --te-hero-max) – a sablonstílus
 *     „Hero magassága” paramétere ugyanúgy hat rá, mint a többi hero-ra;
 *   - a v4 címméretei (hosszú címnél kisebb: --long / --xlong);
 *   - a kép fókuszpontja a cikk hero-fokuszpont mezőjéből (--te-hero-focus);
 *   - az oldalsáv a v4 keretéé (.te-page__sidebar), a kategóriaválasztó a te-card kártyamenü.
 *
 * A kategória színe a --te-cat / --te-cat-ink változókból jön (HSL-hármasok, inline,
 * helpers/TeCategoryColor.php), így a címkék színe a kategóriaválasztóéval egyezik.
 *
 * Hero hangolás (pl. user.css-ben):
 *   --te-hero-x / --te-hero-y   a kör alakú áttűnés középpontja a képen belül
 *   --te-hero-inner             eddig teljesen látszik a kép
 *   --te-hero-outer             innen teljesen kék
 *   --te-hero-shape             circle | ellipse
 *   --te-hero-icons-opacity     a vonalikonos réteg átlátszósága
 *
 * Réteg nélkül (mint a layout.css), így az örökölt tartalmi CSS nem írja felül.
 */

/* ==========================================================================
   Kategória-címke (sáv + kártyák)
   ========================================================================== */

.te-blog__badge {
   display: inline-block;
   padding: 3px 10px 2px;
   border-radius: var(--radius-sm);
   background-color: hsl(var(--te-cat, var(--blue)));
   color: hsl(var(--te-cat-ink, var(--white)));
   font-size: 13px;
   font-weight: 500;
   line-height: 1.3;
   letter-spacing: .01em;
   text-decoration: none;
   transition: filter var(--transition-time);

   &:is(:hover, :focus-visible) {
      color: hsl(var(--te-cat-ink, var(--white)));
      text-decoration: none;
      filter: brightness(1.08) saturate(1.1);
   }
}

/* ==========================================================================
   Kék sáv – a legfrissebb cikk (blog) / a cikk (cikkoldal)
   ========================================================================== */

.te-bloghero {
   --te-cat: var(--blue);
   --te-cat-ink: var(--white);
   --te-hero-shape: circle;
   --te-hero-x: 58%;
   --te-hero-y: 42%;
   --te-hero-inner: 24%;
   --te-hero-outer: 64%;
   --te-hero-h: clamp(240px, 20vw, var(--te-hero-max, 300px));
   --te-hero-btn: var(--strawberry);
   --te-hero-icons-left: url(../images/blog-hero-icons-left.svg);
   --te-hero-icons-right: url(../images/blog-hero-icons-right.svg);
   --te-hero-icons-opacity: .7;
   --te-hero-icons-ratio: .4; /* a bal oldali SVG szélesség / magasság aránya (160 / 400) */

   position: relative;
   isolation: isolate;
   overflow: hidden;
   background-color: hsl(var(--blue));
   color: hsl(var(--white));

   /* vonalikonok – két csoport a konténer két szélén, a sáv magasságához méretezve */
   .te-bloghero__overlay {
      position: absolute;
      inset-block: 0;
      left: 50%;
      z-index: 3;
      width: min(100%, var(--container-max));
      transform: translateX(-50%);
      pointer-events: none;
      opacity: var(--te-hero-icons-opacity);
      background-image: var(--te-hero-icons-left), var(--te-hero-icons-right);
      background-position: left 4px center, right 4px center;
      background-size: auto var(--te-hero-h), auto var(--te-hero-h);
      background-repeat: no-repeat;
   }

   .te-bloghero__inner {
      position: static;
      display: flex;
      align-items: center;
      min-height: var(--te-hero-h);
      padding-block: var(--space-5);
   }

   /* a kép: a sáv jobb 80%-a */
   .te-bloghero__media {
      position: absolute;
      inset: 0 0 0 auto;
      z-index: 1;
      width: 80%;

      img {
         display: block;
         width: 100%;
         height: 100%;
         object-fit: cover;
         object-position: var(--te-hero-focus, center 30%);
      }
   }

   /* kékből átlátszóba futó, kör alakú gradiens + bal oldali sötétítés a szövegnek */
   .te-bloghero__fade {
      position: absolute;
      inset: -1px;
      z-index: 2;
      pointer-events: none;
      background:
         radial-gradient(
            var(--te-hero-shape) at var(--te-hero-x) var(--te-hero-y),
            hsla(var(--blue), 0) 0%,
            hsla(var(--blue), 0) var(--te-hero-inner),
            hsla(var(--blue), .45) calc((var(--te-hero-inner) + var(--te-hero-outer)) / 2),
            hsla(var(--blue), 1) var(--te-hero-outer)
         ),
         linear-gradient(90deg, hsla(var(--blue), .75) 0%, hsla(var(--blue), 0) 40%);
   }

   /* szöveg – a bal oldali ikoncsoport szélességével beljebb */
   .te-bloghero__text {
      position: relative;
      z-index: 4;
      max-width: 62%;
      margin-left: max(0px, calc(var(--te-hero-h) * var(--te-hero-icons-ratio) + 20px - var(--container-pad)));
   }

   .te-bloghero__title {
      margin: var(--space-3) 0 var(--space-3);
      color: hsl(var(--white));
      font-size: clamp(1.75rem, 1.1rem + 1.4vw, 2.5rem);
      font-weight: 700;
      line-height: 1.08;
      text-wrap: balance;
      text-shadow: 0 2px 22px hsla(var(--darkBlue), .55);
      hyphens: manual;

      a {
         color: inherit;
         text-decoration: none;
         transition: opacity var(--transition-time);

         &:is(:hover, :focus-visible) {
            color: inherit;
            opacity: .85;
         }
      }
   }

   &.te-bloghero--long .te-bloghero__title {
      font-size: clamp(1.375rem, .95rem + 1vw, 2rem);
   }

   &.te-bloghero--xlong .te-bloghero__title {
      font-size: clamp(1.25rem, .9rem + .7vw, 1.625rem);
   }

   .te-bloghero__meta {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 4px 14px;
      margin: 0 0 var(--space-4);
      font-size: clamp(15px, 1.1vw, 17px);
      text-shadow: 0 1px 12px hsla(var(--darkBlue), .6);
   }

   .te-bloghero__author {
      font-weight: 500;
   }

   .te-bloghero__date {
      opacity: .85;
   }

   .te-bloghero__author + .te-bloghero__date::before {
      content: '';
      position: relative;
      top: -2px;
      display: inline-block;
      width: 5px;
      height: 5px;
      margin-right: 14px;
      vertical-align: middle;
      border-radius: 50%;
      background-color: hsl(var(--gold));
   }

   .te-bloghero__more {
      display: inline-flex;
      align-items: center;
      gap: 12px;
      padding: 8px 18px 9px;
      border-radius: var(--radius);
      background-color: hsl(var(--te-hero-btn));
      color: hsl(var(--white));
      font-size: 17px;
      font-weight: 500;
      line-height: 1;
      text-decoration: none;
      transition: background-color var(--transition-time);

      svg {
         transition: transform var(--transition-time);
      }

      &:is(:hover, :focus-visible) {
         color: hsl(var(--white));
         background-color: hsla(var(--te-hero-btn), .85);
         text-decoration: none;

         svg {
            transform: translateX(4px);
         }
      }

      &:focus-visible {
         outline: 2px solid hsl(var(--white));
         outline-offset: 2px;
      }
   }

   /* cikkoldal: nincs gomb, a cím alatt csak a meta */
   &.te-bloghero--article .te-bloghero__meta {
      margin-bottom: 0;
   }

   &:is(.te-bloghero--noimage, .te-bloghero--empty) .te-bloghero__text {
      max-width: 820px;
   }
}

@media (width < 1040px) {
   .te-bloghero {
      --te-hero-x: 62%;
      --te-hero-inner: 18%;
      --te-hero-outer: 70%;

      .te-bloghero__media {
         width: 90%;
      }

      .te-bloghero__text {
         max-width: 75%;
      }
   }
}

/* Mobil: kép felül, alja kékbe fut, szöveg alatta */
@media (width < 768px) {
   .te-bloghero {
      .te-bloghero__inner {
         display: block;
         min-height: 0;
         padding-block: 0 var(--space-5);
      }

      .te-bloghero__media {
         position: relative;
         width: auto;
         margin-inline: calc(var(--container-pad) * -1);
         aspect-ratio: 16 / 9;
      }

      .te-bloghero__fade {
         background:
            radial-gradient(
               ellipse at 50% 35%,
               hsla(var(--blue), 0) 0%,
               hsla(var(--blue), 0) 35%,
               hsla(var(--blue), .6) 75%,
               hsla(var(--blue), 1) 100%
            ),
            linear-gradient(180deg, hsla(var(--blue), 0) 55%, hsla(var(--blue), 1) 100%);
      }

      /* csak a jobb oldali ikoncsoport, kisebben, a kép jobb felső sarkában */
      .te-bloghero__overlay {
         --te-hero-icons-opacity: .45;
         background-image: var(--te-hero-icons-right);
         background-position: right 6px top 8px;
         background-size: auto min(180px, 42vw);
      }

      .te-bloghero__text {
         max-width: none;
         margin: -48px 0 0;
      }

      .te-bloghero__title {
         font-size: clamp(1.5rem, 1.1rem + 2vw, 1.875rem);
      }

      &.te-bloghero--long .te-bloghero__title {
         font-size: clamp(1.375rem, 1rem + 1.6vw, 1.625rem);
      }

      &.te-bloghero--xlong .te-bloghero__title {
         font-size: 1.25rem;
      }

      &:is(.te-bloghero--noimage, .te-bloghero--empty) {
         .te-bloghero__inner {
            padding-top: var(--space-6);
         }

         .te-bloghero__text {
            margin-top: 0;
         }
      }
   }
}

/* ==========================================================================
   Blog: cikkrács
   ========================================================================== */

.te-blog {
   min-width: 0;

   .te-blog__heading {
      margin: 0 0 var(--space-5);
      color: hsl(var(--blue));
      font-size: var(--fs-2xl);
      font-weight: 700;
      line-height: 1.1;
   }

   /* alkategória-oldal: a kategória színével jelölve */
   .te-blog__heading--category {
      padding-left: 14px;
      border-left: 5px solid hsl(var(--te-cat, var(--blue)));
   }

   .te-blog__desc {
      margin-bottom: var(--space-6);
   }

   /* automatikus oszlopszám: annyi oszlop, ahány legalább --te-blog-card-min széles kártya elfér */
   .te-blog__grid {
      --te-blog-card-min: 260px;

      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(min(var(--te-blog-card-min), 100%), 1fr));
      gap: 44px var(--gap);
      margin-bottom: 44px;
   }

   .te-blog__links {
      margin: 0 0 var(--space-6);
      padding-left: 18px;
      list-style: disc;

      li {
         margin-bottom: 6px;
      }
   }
}

@media (width < 600px) {
   .te-blog .te-blog__grid {
      row-gap: 36px;
   }
}

/* ==========================================================================
   Cikk-kártya
   ========================================================================== */

.te-blogcard {
   --te-cat: var(--blue);
   --te-cat-ink: var(--white);

   display: flex;
   flex-direction: column;
   min-width: 0;

   .te-blogcard__head {
      margin-bottom: var(--space-2);
   }

   .te-blogcard__media {
      display: block;
      overflow: hidden;
      aspect-ratio: 16 / 9;
      border-radius: var(--radius-sm);
      background-color: hsl(var(--blue));

      img {
         display: block;
         width: 100%;
         height: 100%;
         object-fit: cover;
         transition: transform 600ms ease;
      }
   }

   .te-blogcard__placeholder {
      display: block;
      width: 100%;
      height: 100%;
      background: url(../images/logo_monochrome_white.svg) center / 34% auto no-repeat hsl(var(--blue));
      opacity: .9;
   }

   &:hover .te-blogcard__media img {
      transform: scale(1.04);
   }

   .te-blogcard__title {
      margin: 18px 0 8px;
      color: hsl(var(--blue));
      font-size: clamp(1.1875rem, 1rem + .4vw, 1.375rem);
      font-weight: 500;
      line-height: 1.2;
      hyphens: manual;

      a {
         color: inherit;
         text-decoration: none;

         &:is(:hover, :focus-visible) {
            color: hsla(var(--blue), .7);
         }
      }
   }

   /* dátum és szerző a cím alatt, egymás alatt, aranysárgán (mint a hírblokkban) */
   .te-blogcard__meta {
      display: flex;
      flex-direction: column;
      gap: 1px;
      margin: 0;
      color: hsl(43, 100%, 31%);
      font-size: 13px;
      font-weight: 600;
      line-height: 1.35;
   }

   .te-blogcard__intro {
      display: -webkit-box;
      margin: 12px 0 0;
      overflow: hidden;
      color: hsl(var(--midGray));
      font-size: 15px;
      line-height: 1.5;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 9;
      line-clamp: 9;
   }

   &.system-unpublished {
      opacity: .6;
      outline: 2px dashed hsla(var(--strawberry), .6);
      outline-offset: 6px;
   }
}

/* ==========================================================================
   Cikkoldal
   ========================================================================== */

.te-blogarticle {
   min-width: 0;

   .te-blogarticle__body {
      color: hsl(var(--midGray));
      font-size: 17px;
      line-height: 1.6;

      > :first-child {
         margin-top: 0;
      }

      :is(p, li) {
         font-size: inherit;
         line-height: inherit;
      }

      p {
         margin: 0 0 18px;
      }

      :is(h2, h3, h4) {
         margin: 1.6em 0 .6em;
         color: hsl(var(--blue));
         font-weight: 700;
         line-height: 1.2;
      }

      h2 { font-size: 1.75rem; }
      h3 { font-size: 1.4375rem; }
      h4 { font-size: 1.1875rem; }

      :is(ul, ol) {
         margin: 0 0 20px 22px;
      }

      ul { list-style: disc; }
      ol { list-style: decimal; }

      li {
         margin-bottom: 6px;
      }

      blockquote {
         margin: 28px 0;
         padding: 4px 0 4px 22px;
         border-left: 4px solid hsl(var(--te-cat, var(--gold)));
         color: hsl(var(--blue));
         font-size: 20px;
         line-height: 1.45;
      }

      figure {
         margin: 24px 0;
      }

      figcaption {
         margin-top: 6px;
         color: hsla(var(--black), .55);
         font-size: 13px;
      }

      img {
         max-width: 100%;
         height: auto;
      }

      table {
         width: 100%;
         margin-bottom: 20px;
         border-collapse: collapse;
      }

      :is(th, td) {
         padding: 8px 10px;
         border-bottom: 1px solid hsla(var(--black), .1);
         text-align: left;
      }
   }
}

/* Oldalsáv: a cikk záró része (lektor, kapcsolat, a szerzőről) – a kártyamenü megjelenésével */
.te-articleaside {
   margin: 0;
   overflow: hidden;
   border: var(--te-side-border, 1px solid hsla(var(--darkBlue), .1));
   border-radius: var(--te-side-radius, var(--radius-lg));
   background-color: hsl(var(--white));
   font-size: 15px;
   line-height: 1.5;
   overflow-wrap: anywhere;

   .te-articleaside__title {
      margin: 0;
      padding: 20px 22px 22px;
      background-color: hsl(var(--blue));
      color: hsl(var(--white));
      font-size: 21px;
      font-weight: 700;
      line-height: 1.2;
   }

   .te-articleaside__body {
      padding: 18px 22px 22px;
      color: hsl(var(--midGray));

      > :last-child {
         margin-bottom: 0;
      }

      p {
         margin: 0 0 12px;
      }

      :is(h2, h3, h4, h5, strong:only-child) {
         color: hsl(var(--blue));
      }

      :is(h2, h3, h4, h5) {
         margin: 16px 0 6px;
         font-size: 16px;
         font-weight: 700;
         line-height: 1.3;
      }

      > :is(h2, h3, h4, h5):first-child {
         margin-top: 0;
      }

      img {
         max-width: 100%;
         height: auto;
         border-radius: var(--radius);
      }

      hr {
         margin: 14px 0;
         border: 0;
         border-top: 1px solid hsla(var(--black), .1);
      }
   }
}

/* 1040 px alatt az oldalsáv két oszlopos: az „A cikkről” doboz teljes szélességű */
@media (576px <= width < 1040px) {
   .te-page__sidebar > .te-articleaside {
      grid-column: 1 / -1;
   }
}

/* Cikkbeli képnagyító (.zoom) a blog cikkoldalán és az „A cikkről” dobozban (4.1.3).
   A legacy-content.js a .zoom képet .zoom-wrapper dobozba teszi, és a kép inline float-ját
   a dobozra viszi át. A v3 szabályai (legacy-content.css) csak <article>-en belül élnek, a
   teblog nézet gyökere viszont <div>: itt ugyanazok a szabályok, a blog szövegére szűkítve.
   A nagyított kép a közös .te-lightbox rétegben jelenik meg (lightbox.css). */
:is(.te-blogarticle__body, .te-articleaside__body) {
   /* A kép kitölti a dobozát, mint az <article>-ben (legacy: „article p img { width: 100% }”) */
   .zoom-wrapper > img {
      width: 100%;
      height: auto;
      border-radius: var(--radius);

      &.inline {
         width: unset;
         max-width: 100%;
      }
   }

   .zoom-wrapper.left {
      width: 50%;
      float: left;
      margin-right: 20px;
   }

   .zoom-wrapper.right {
      width: 50%;
      float: right;
      margin-left: 20px;
   }

   .zoom-wrapper:is(.fullwidth, .teljesszelesseg) {
      width: 100%;

      > img {
         width: 100% !important;
         height: auto;
      }
   }

   .zoom-wrapper:is(.threequaterwidth, .haromnegyedhasab) {
      width: 75%;

      > img {
         width: 100% !important;
         height: auto;
      }
   }

   .zoom-wrapper:is(.halfwidth, .felhasab) {
      width: 50%;

      > img {
         width: 100% !important;
         height: auto;
      }
   }

   .zoom-wrapper:is(.thirdwidth, .harmadhasab) {
      width: 33%;

      > img {
         width: 100% !important;
         height: auto;
      }
   }

   .zoom-wrapper:is(.quaterwidth, .negyedhasab) {
      width: 25%;

      > img {
         width: 100% !important;
         height: auto;
      }
   }

   .zoom-wrapper:is(.fifthwidth, .otodhasab) {
      width: 20%;

      > img {
         width: 100% !important;
         height: auto;
      }
   }

   .zoom-wrapper:is(.sixthwidth, .hatodhasab) {
      width: 16%;

      > img {
         width: 100% !important;
         height: auto;
      }
   }

   .zoom-wrapper:is(.tenthwidth, .tizedhasab) {
      width: 10%;

      > img {
         width: 100% !important;
         height: auto;
      }
   }

   .zoom-wrapper {
      img:is(.fullwidth, .teljesszelesseg) {
         width: 100%;
      }
      img:is(.threequaterwidth, .haromnegyedhasab) {
         width: 75%;
      }
      img:is(.halfwidth, .felhasab) {
         width: 50%;
      }
      img:is(.thirdwidth, .harmadhasab) {
         width: 33%;
      }
      img:is(.quaterwidth, .negyedhasab) {
         width: 25%;
      }
      img:is(.fifthwidth, .otodhasab) {
         width: 20%;
      }
      img:is(.sixthwidth, .hatodhasab) {
         width: 16%;
      }
      img:is(.tenthwidth, .tizedhasab) {
         width: 10%;
      }
   }
}
