/* Knowledge base: ingredient articles + listing. Global vars from leafspirit.css. */

/* Text face for long-form reading: Source Serif 4 (pairs with the site's
   Source Sans 3 UI font). Variable woff2, self-hosted like Nunito/Playfair;
   loaded only on knowledge pages. */
@font-face{
  font-family:'Source Serif 4';font-style:normal;font-weight:200 900;font-display:swap;
  src:url('../fonts/source-serif4-cyrillic.woff2') format('woff2');
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face{
  font-family:'Source Serif 4';font-style:normal;font-weight:200 900;font-display:swap;
  src:url('../fonts/source-serif4-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

.kb-index { max-width: 820px; margin: 0 auto; padding: 2.75rem 1.25rem 4rem; }

/* ── Article layout: handbook sidebar + text column ── */
/* Flow geometry is exact: text 37rem + gutter 3.5rem + card 200px = 848px =
   four 200px cards with three 1rem gaps. Left-aligned rows therefore END on
   the same right edge as the lone card beside the text. The container gets a
   -1rem right margin so a trailing card margin never wraps the fourth card. */
.kb-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: auto 1fr; gap: 1.4rem 3rem;
  max-width: 1164px; padding-top: 2.75rem; padding-bottom: 4rem; }
.kb-layout > .breadcrumbs { grid-column: 1; grid-row: 1; }
.kb-side { grid-column: 1; grid-row: 2; }
.kb-article { grid-column: 2; grid-row: 1 / span 2; width: 848px; max-width: 100%; }
.kb-article::after { content: ""; display: table; clear: both; }
.kb-text { float: left; width: min(37rem, 100%); margin-right: 3.5rem; }

/* ≤3 teas: no wrap-around needed — sticky rail in a third column instead */
.kb-has-rail { grid-template-columns: 220px minmax(0, 1fr) 200px; max-width: 1240px; }
.kb-has-rail .kb-article { width: auto; max-width: 40rem; }
.kb-has-rail .kb-text { float: none; width: auto; margin-right: 0; }
.kb-aside { grid-column: 3; grid-row: 1 / span 2; position: sticky; top: 96px; align-self: start; }
.kb-aside .kb-product-card { display: flex; width: 100%; margin: 0 0 1.25rem; }

.kb-side { position: sticky; top: 96px; align-self: start; }
.kb-side-group + .kb-side-group { margin-top: 1.75rem; }
.kb-side-label { display: block; font-size: .64rem; font-weight: 600; letter-spacing: .24em;
  text-transform: uppercase; color: var(--gold); margin-bottom: .85rem; padding-left: .75rem; }
.kb-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; }
.kb-side-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem;
  border-left: 2px solid transparent; border-radius: 0 8px 8px 0;
  color: var(--text-light); font-size: .95rem; line-height: 1.3;
  transition: color .2s, background-color .2s; }
a.kb-side-item:hover { color: var(--tea-dark); background: rgba(201,169,110,.08); }
.kb-side-item.is-current { border-left-color: var(--gold); color: var(--text); font-weight: 600;
  background: rgba(201,169,110,.1); }
.kb-side-hanzi { font-family: 'Noto Serif SC', var(--font-display); font-size: 1.1rem; line-height: 1;
  color: var(--gold); opacity: .8; flex: none; }

@media (max-width: 900px){
.kb-layout { display: block; padding-top: 2rem; }
.kb-layout > .breadcrumbs { margin-bottom: 1.2rem; }
.kb-side { position: static; margin-bottom: 1.9rem; }
.kb-side-label { padding-left: 0; }
.kb-side ul { flex-direction: row; flex-wrap: wrap; gap: .45rem .5rem; }
.kb-side-item { border: 1px solid var(--gold-light); border-radius: 999px; padding: .45rem .85rem; font-size: .85rem; }
.kb-side-item.is-current { background: var(--gold); border-color: var(--gold); color: var(--text); }
.kb-side-hanzi { display: none; }
.kb-text { float: none; width: auto; margin-right: 0; }
.kb-rail, .kb-teas-below, .kb-aside { float: none; clear: none; width: auto; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; margin: 2.25rem 0 0; padding-top: 0; position: static; }
.kb-teas-below { margin-top: 1rem; }
.kb-teas-below .kb-teas-label { display: none; }
.kb-teas-label { grid-column: 1 / -1; margin: 0; }
.kb-rail .kb-product-card, .kb-teas-below .kb-product-card, .kb-aside .kb-product-card { width: auto; margin: 0; display: flex; height: auto; }
}

/* ── Index ── */
.kb-index-head { text-align: center; margin-bottom: 2.75rem; }
.kb-index-head h1 { font-size: clamp(2.1rem, 6vw, 2.9rem); font-weight: 600; }
.kb-index-head h1::after { content: ""; display: block; width: 56px; height: 1px; background: var(--gold); margin: 1.1rem auto 0; }
.kb-intro { font-family: 'Source Serif 4', 'Noto Serif SC', georgia, serif; color: var(--text-light);
  max-width: 52ch; margin: 1.1rem auto 0; font-size: 1.08rem; }

.kb-index-section + .kb-index-section { margin-top: 3rem; }
.kb-section-label { font-family: 'Source Sans 3', sans-serif; font-size: .72rem; font-weight: 600;
  letter-spacing: .24em; text-transform: uppercase; color: var(--gold); text-align: center;
  margin-bottom: 1.4rem; }
.kb-section-label::after { content: ""; display: block; width: 2.25rem; height: 1px;
  background: var(--gold-light); margin: .8rem auto 0; }
.kb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.25rem; }
.kb-card { position: relative; display: flex; flex-direction: column; padding: 1.6rem 1.5rem 1.4rem;
  border: 1px solid var(--gold-light); border-radius: 14px; background: rgba(255,255,255,.5);
  transition: border-color .3s var(--ease-silk), transform .3s var(--ease-silk), box-shadow .3s var(--ease-silk); }
.kb-card:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 10px 28px rgba(61,74,53,.08); }
.kb-card-hanzi { font-family: 'Noto Serif SC', var(--font-display); font-size: 3.4rem; line-height: 1;
  color: rgba(201,169,110,.45); margin-bottom: .9rem; }
.kb-card-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: var(--text); margin-bottom: .45rem; }
.kb-card-teaser { font-family: 'Source Serif 4', 'Noto Serif SC', georgia, serif;
  font-size: .92rem; line-height: 1.6; color: var(--text-light);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kb-card-more { margin-top: 1rem; color: var(--gold); font-size: 1.05rem; transition: transform .3s var(--ease-silk); }
.kb-card:hover .kb-card-more { transform: translateX(4px); }

/* ── Article ── */
.kb-article-head { position: relative; margin-bottom: 1.9rem; max-width: 37rem; }
.kb-hanzi-mark { position: absolute; right: 0; top: -1rem; font-family: 'Noto Serif SC', var(--font-display);
  font-size: clamp(3.5rem, 9vw, 6rem); line-height: 1; color: rgba(201,169,110,.15);
  pointer-events: none; user-select: none; }
.kb-article-head h1 { position: relative; font-size: clamp(2rem, 6vw, 2.7rem); font-weight: 600; margin-top: -.4rem; }
.kb-article-head h1::after { content: ""; display: block; width: 56px; height: 1px; background: var(--gold); margin-top: 1rem; }

.kb-body { font-family: 'Source Serif 4', 'Noto Serif SC', georgia, serif; font-size: 1.0625rem;
  line-height: 1.72; max-width: 37rem; font-optical-sizing: auto; }
.kb-body p { margin: 0 0 1.2em; text-align: justify; -webkit-hyphens: auto; hyphens: auto; }
.kb-body > p:first-child { font-size: 1.19rem; line-height: 1.65; color: var(--tea-dark); }
.kb-body h2 { font-family: 'Source Serif 4', 'Noto Serif SC', georgia, serif; font-size: 1.5rem;
  font-weight: 600; letter-spacing: 0; margin: 2.6rem 0 .9rem; text-wrap: balance; }
.kb-body h2::before { content: ""; display: block; width: 2.25rem; height: 1px; background: var(--gold); margin-bottom: .7rem; }

.kb-disclaimer { margin-top: 3rem; font-size: .8rem; font-style: italic; color: var(--text-light);
  border-top: 1px solid var(--gold-light); padding-top: 1rem; max-width: 37rem; }

/* ── "Found in these teas": cards flow around the floated text — filling the
   strip to its right, then continuing full-width below it ── */
/* Right rail: always the first three teas, stacked beside the text */
.kb-rail { float: right; width: 200px; }
.kb-rail .kb-product-card { display: flex; width: 100%; margin: 0 0 1.25rem; }
/* The rest continue below the content. font-size: 0 kills the whitespace
   between inline-block cards so four 216px margin-boxes fit the 864px line
   (848 + 1rem hang) exactly. */
.kb-teas-below { clear: both; margin-right: -1rem; font-size: 0; padding-top: 1.25rem; }
.kb-teas-label { display: block; font-size: .64rem; font-weight: 600; letter-spacing: .24em;
  text-transform: uppercase; color: var(--gold); margin: .2rem 0 1rem; }
.kb-product-card { display: inline-flex; flex-direction: column; vertical-align: top;
  width: 200px; height: 18rem; text-align: left;
  font-size: 1rem; margin: 0 1rem 1.25rem 0; padding: .8rem .8rem .95rem;
  background: var(--warm-white); border: 1px solid var(--gold-light); border-radius: 12px;
  color: var(--tea-dark); transition: border-color .2s; }
.kb-product-card:hover { border-color: var(--gold); }
.kb-product-card img { width: 100%; height: auto; border-radius: 8px; display: block; margin-bottom: .55rem; }
.kb-product-card:hover .kb-product-name { text-decoration: underline; text-underline-offset: 3px; }
.kb-product-name { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; font-weight: 600; line-height: 1.35; font-size: .92rem; }
/* price pinned to the card's bottom edge so all cards read as one row */
.kb-product-price { display: block; font-size: .82rem; color: var(--gold-deep); margin-top: auto; padding-top: .3rem; }

/* Breadcrumbs (same look as catalog.css — that file isn't loaded here) */
.breadcrumbs{margin:0 0 .25rem}
.breadcrumbs ol{list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:.1rem .45rem;margin:0;padding:0;font-size:.8rem}
.breadcrumbs li{display:inline-flex;align-items:center;color:var(--text-light)}
.breadcrumbs li+li::before{content:"/";margin-right:.45rem;color:var(--gold-light)}
.breadcrumbs a{color:var(--text-light);text-decoration:none;transition:color .15s}
.breadcrumbs a:hover{color:var(--gold)}
.breadcrumbs [aria-current="page"]{color:var(--text)}

@media (prefers-reduced-motion: reduce){
  .kb-card, .kb-card-more { transition: none; }
  .kb-card:hover { transform: none; }
  .kb-card:hover .kb-card-more { transform: none; }
}
