/* PROM-IN | Autorská vizitka v článcích a v produktové sekci „Na rovinu“
   Načtěte za stávajícími styly webu. Třídy patří opakovanému bloku autorů.
   Otevření profilu dál obsluhuje původní odkaz „Více o autorovi“. */
ul.authorin.autorli,
.fancy-final .author-card:has(> .author-header > .author-info) {
  --autor-zelena: #7ab800;
  --autor-kremova: #f0eae2;
  --autor-panel: #141414;
  --autor-bila: #fff;
}

ul.authorin.autorli {
  float: none;
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 0;
  margin: 14px 0 22px;
  list-style: none;
  container: autori / inline-size;
}

/* Šířku mobilního rozložení určujeme podle prostoru v sekci. */
.fancy-final:has(.author-card > .author-header > .author-info) {
  container: autori / inline-size;
}

/* Portrét vlevo, tři řádky obsahu vpravo. Rozměry vycházejí ze šířky článku. */
ul.authorin.autorli > li.author-item,
.fancy-final .author-card:has(> .author-header > .author-info) {
  box-sizing: border-box;
  float: none;
  width: 100%;
  max-width: 480px;
  margin: 0;
  display: grid;
  --autor-portret: 56px;
  grid-template-columns: var(--autor-portret) minmax(0, 1fr);
  grid-template-areas: "foto jmeno" "foto popis" "foto odkaz";
  gap: 3px 14px;
  padding: 14px 18px;
  border: 1px solid #30312e;
  border-radius: 14px;
  background: var(--autor-panel);
  color: var(--autor-bila);
  text-align: left;
  line-height: 1.5;

  &::before { content: none; }
  & > :is(.fotkaautor, .jmenoautor, .popisautor, .author-more) {
    position: static;
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
  }

  /* Zelený prstenec má od fotografie tenký tmavý odstup. */
  & > .fotkaautor, & .author-header > .imgouts, & .author-header > img.author-img {
    grid-area: foto;
    align-self: center;
    width: 100%;
    max-width: 56px;
  }
  & > .fotkaautor img, & .author-header img.author-img {
    float: none;
    margin: 0;
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: center 32%;
    padding: 2px;
    border: 1px solid var(--autor-zelena);
    border-radius: 50%;
    background: var(--autor-panel);
  }

  /* Šablona zapisuje velikost písma přímo na text s !important.
     Zmenšení se proto aplikuje jen na tyto tři texty uvnitř vizitky. */
  & > .jmenoautor h2[style*="font-size"] { zoom: .59; }
  & > .popisautor p[style*="font-size"], & .author-info > p[style*="font-size"] { zoom: .84; }
  & > .author-more a[style*="font-size"], & .author-info > a.author-more[style*="font-size"] { zoom: .80; }
  & > .jmenoautor { grid-area: jmeno; }
  & > .jmenoautor h2, & .author-info > h3 {
    float: none;
    width: auto;
    margin: 0;
    color: var(--autor-bila);
    font-size: 21px;
    line-height: 1.2;
    letter-spacing: -.025em;
    text-align: inherit;
    overflow-wrap: anywhere;
  }
  & > .popisautor { grid-area: popis; }
  & > .popisautor p, & .author-info > p {
    margin: 0;
    color: var(--autor-kremova);
    font-size: 15px;
    line-height: 1.4 !important;
    text-align: inherit;
  }

  /* Odkaz má na telefonu dostatečně vysokou dotykovou plochu. */
  & > .author-more {
    grid-area: odkaz;
    justify-self: start;
    opacity: 1;
    text-decoration: none;
  }
  & > .author-more a.open-author-popup, & .author-info > a.author-more {
    float: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    margin: 0;
    color: var(--autor-zelena) !important;
    text-decoration: none;
    font-size: 14px;
    text-underline-offset: 3px;
  }
  & > .author-more a.open-author-popup::after, & .author-info > a.author-more::after {
    content: "";
    width: 6px;
    height: 6px;
    border: solid currentColor;
    border-width: 2px 2px 0 0;
    transform: rotate(45deg);
  }
  & > .author-more a:is(:hover, :focus-visible), & .author-info > a.author-more:is(:hover, :focus-visible) { text-decoration: underline; }
  & > .author-more a:focus-visible, & .author-info > a.author-more:focus-visible {
    outline: 2px solid var(--autor-zelena);
    outline-offset: 3px;
  }
}

/* Produkt má jiné HTML. Oba vnitřní obaly předají své prvky do stejné mřížky
   jako v článku. Text medailonku včetně původního p::before dodává e-shop. */
.fancy-final .author-card:has(> .author-header > .author-info) {
  margin-block: 14px 0;
  background-color: var(--autor-panel) !important;
  box-shadow: none;
  & > .author-header, & > .author-header > .author-info { display: contents; }
  & .author-header > .imgouts { float: none; margin: 0; padding: 0; }
  & .author-header > .imgouts::before, & .author-header > .imgouts::after { content: none; }
  & .author-info > h3 { grid-area: jmeno; margin: 0 !important; }
  & .author-info > p { grid-area: popis; color: var(--autor-kremova) !important; }
  & .author-info > a.author-more {
    grid-area: odkaz;
    justify-self: start;
    position: static;
    opacity: 1;
  }
  /* Produktový nadpis je h3, zatímco článek používá větší h2. */
  & .author-info > h3[style*="font-size"] { zoom: .71; }
}

/* Na úzké ploše zůstane portrét vedle jména. Medailonek využije celou šířku. */
@container autori (max-width: 480px) {
  ul.authorin.autorli > li.author-item,
  .fancy-final .author-card:has(> .author-header > .author-info) {
    --autor-portret: 54px;
    grid-template-areas: "foto jmeno" "popis popis" "odkaz odkaz";
    gap: 6px 12px;
    padding: 15px;
  }
  ul.authorin.autorli > li.author-item > .jmenoautor,
  .fancy-final .author-card:has(> .author-header > .author-info) .author-info > h3 { align-self: center; }
}

/* V mobilní sekci „Na rovinu“ šablona vynucuje na obrázcích výšku 95 px
   a posouvá je doprava o 35 px. Portrét patří celý do prvního sloupce. */
@media (max-width: 600px) {
  .fancy-final .author-card:has(> .author-header > .author-info) .author-header img.author-img {
    position: static;
    inset: auto;
    float: none;
    margin: 0;
    box-sizing: border-box;
    width: var(--autor-portret);
    height: var(--autor-portret) !important;
    object-fit: cover;
    border-radius: 50%;
  }
}

/* Na telefonu už šablona používá menší písmo. Odkaz má prostor pro dotyk. */
@media (max-width: 600px) {
  ul.authorin.autorli > li.author-item,
  .fancy-final .author-card:has(> .author-header > .author-info) {
    & > .jmenoautor h2[style*="font-size"] { zoom: .88; }
    & .author-info > h3[style*="font-size"] { zoom: 1; }
    & > .popisautor p[style*="font-size"], & .author-info > p[style*="font-size"] { zoom: .96; }
    & > .author-more a.open-author-popup, & .author-info > a.author-more {
      zoom: 1;
      min-height: 44px;
    }
  }
}
