/*
 * Kitchen Infinity – Operating Manual (templates/template-operating-manual.php)
 * Brand tabs (row) + category tabs (column) → one dropdown on mobile; 2-column video cards.
 * From docs/pages/_dev/css/60-company.css (company-filter + company-listing). Shared: components.css.
 */

.ki-filter {
  position: relative;
}

.ki-filter__toggle {
  display: none;
}

.ki-filter__list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.ki-filter__list a,
.ki-filter__list button {
  position: relative;
  display: inline-block;
  text-align: left;
  opacity: .5;
  transition: opacity .3s var(--ki-ease);
  color: var(--wp--preset--color--ink);
}

.ki-filter__list a {
  text-transform: inherit;
}

.ki-filter__list a::after,
.ki-filter__list button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .45s var(--ki-ease-out);
}

.ki-filter__list a:hover,
.ki-filter__list button:hover,
.ki-filter__list a:focus-visible,
.ki-filter__list button:focus-visible,
.ki-filter__list .current-menu-item > a,
.ki-filter__list .current-menu-item > button {
  opacity: 1;
}

.ki-filter__list a:hover::after,
.ki-filter__list button:hover::after,
.ki-filter__list .current-menu-item > a::after,
.ki-filter__list .current-menu-item > button::after {
  transform: scaleX(1);
  transform-origin: left;
}

.ki-filter__list--row {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 15px 50px;
  font-size: var(--ki-h3);
  line-height: 30px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--wp--preset--color--brown);
}

.ki-filter__list--row .current-menu-item > a,
.ki-filter__list--row .current-menu-item > button {
  color: var(--wp--preset--color--ink);
}

.ki-filter__list--col {
  gap: 15px;
  font-size: 20px;
  line-height: 25px;
  font-weight: 500;
}

@media (max-width: 900px) {
  .ki-filter {
    z-index: 5;
  }

  .ki-filter__toggle {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    height: 40px;
    padding-bottom: 15px;
    border-bottom: .5px solid var(--wp--preset--color--ink);
    font-size: 16px;
    line-height: 25px;
    text-align: left;
  }

  .ki-filter__toggle svg {
    flex: none;
    transition: transform .3s var(--ki-ease-out);
  }

  .ki-filter.is-open .ki-filter__toggle svg {
    transform: rotate(180deg);
  }

  .ki-filter__panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    padding: 20px;
    background: var(--wp--preset--color--cream);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .3s, transform .4s var(--ki-ease-out), visibility 0s .3s;
  }

  .ki-filter.is-open .ki-filter__panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }

  .ki-filter__list,
  .ki-filter__list--row,
  .ki-filter__list--col {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 14px;
    font-size: 16px;
    line-height: 25px;
    font-weight: 400;
    text-transform: none;
    color: var(--wp--preset--color--ink);
  }

  .ki-filter__list--row {
    font-weight: 500;
  }

  .ki-filter__list + .ki-filter__list {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--ki-company-line);
  }
}

.ki-company-listing-page {
  padding-bottom: 100px;
}

.ki-company-listing {
  display: grid;
  grid-template-columns: 223px minmax(0, 1fr);
  padding-top: 50px;
  align-items: start;
}

.ki-company-listing__filter,
.ki-company-listing__filter .ki-filter__panel {
  display: contents;
}

.ki-company-listing__tabs {
  grid-column: 1/-1;
  margin-bottom: 50px;
}

.ki-company-listing__side {
  grid-column: 1;
}

.ki-company-listing__main {
  grid-column: 2;
}

.ki-company-listing__main .ki-pagination {
  margin-top: 100px;
}

.ki-manuals .ki-grid .entry-title {
  min-height: 60px;
}

/* hover = styleguide "Text links": 1px underline drawn in from the left, under every line; the thumbnail triggers it too */
.ki-manuals .ki-grid .entry-title a {
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  transition: background-size .45s var(--ki-ease-out);
}

.ki-manuals .ki-grid .entry-title a:hover,
.ki-manuals .ki-grid article:has(.ki-video-thumb:hover) .entry-title a {
  background-size: 100% 1px;
  text-decoration: none;
}

/* zh (Noto Sans SC): the glyph box is taller than the line – lift the underline (else clipped by the 2-line clamp) */
:lang(zh) .ki-manuals .ki-grid .entry-title a {
  background-position-y: bottom .15em;
}

.ki-manuals__grid {
  max-width: 1092px;
}

/* Imagify "WebP via <picture>" wraps every <img>: keep sizing the <img> against its real container */
.site-main picture {
  display: contents;
}

/* pagination: the digits' ink sits .125em above the line-box centre (font metrics) – lift the ‹ › to match */
.ki-pagination .prev svg,
.ki-pagination .next svg {
  transform: translateY(-.125em);
}

/* zh (Noto Sans SC): the digits' ink sits .08em below the line-box centre – drop the ‹ › instead */
:lang(zh) .ki-pagination :is(.prev, .next) svg {
  transform: translateY(.08em);
}

/* video thumb sized here (not by the shared .ki-grid / .ki-cover rules): width-driven, 533 × 300 */
.ki-manuals__grid .post-thumbnail {
  height: auto;
  aspect-ratio: 533/300 !important;   /* beats the !important of .ki-video-thumb in components.css */
}

.ki-company-listing-page .ki-container::after {
  background: #897B71;
}

@media (min-width: 901px) {
  /* design rows repeat every ~428.75px (thumb 300 + 20 + title 60 + gap) → 49px instead of 50 */
  .ki-manuals__grid {
    row-gap: 49px;
  }
}

@media (max-width: 1280px) {
  .ki-company-listing {
    grid-template-columns: 180px minmax(0, 1fr);
  }
}

/* 2 videos per row down to 621px (the shared .ki-grid--2 drops to 1 column at 900px) */
@media (min-width: 621px) and (max-width: 900px) {
  .ki-manuals__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
  }
}

@media (max-width: 900px) {
  .ki-manuals__grid .post-thumbnail {
    aspect-ratio: 349/196 !important;
  }

  .ki-company-listing-page {
    padding-bottom: 75px;
  }

  .ki-company-listing {
    display: block;
    padding-top: 40px;
  }

  .ki-company-listing__filter {
    display: block;
  }

  .ki-company-listing__filter .ki-filter__panel {
    display: block;
  }

  .ki-company-listing__tabs {
    margin-bottom: 0;
  }

  .ki-company-listing__main {
    margin-top: 40px;
  }

  .ki-company-listing__main .ki-pagination {
    margin-top: 78px;
  }

  /* Figma mobile keeps the desktop 18px numbers; arrows 12px from the numbers */
  .ki-company-listing__main .ki-pagination .nav-links {
    gap: 35px;
    font-size: 18px;
  }

  .ki-company-listing__main .ki-pagination .prev {
    margin-right: -23px;
  }

  .ki-company-listing__main .ki-pagination .next {
    margin-left: -23px;
  }

  .ki-manuals .ki-grid .entry-title {
    min-height: 0;
  }
}

.ki-manuals__empty {
  color: var(--wp--preset--color--muted);
}
