/* =========================================================
   Li-Cha — blog (listing, article) + homepage "latest" block
   Builds on the tokens and drawing system in main.css.
   ========================================================= */

/* drawings outside the product sheet are normal, visible, in-flow images */
.tile .drawing, .feat .drawing, .acover .drawing, .afig .drawing {
  position: static; inset: auto; opacity: 1; display: block; width: 100%; height: auto;
}
.drawing.is-thumb .bal, .drawing.is-thumb .bt, .drawing.is-thumb .ld, .drawing.is-thumb .ldot,
.drawing.is-thumb .dt, .drawing.is-thumb .d, .drawing.is-thumb .dh { display: none; }

.blog-page { background: var(--galv) var(--grain); }
.blog-page main { padding-top: var(--nav-h); }
.blog-page a:not(.btn) { text-decoration-thickness: 1px; text-underline-offset: .3em; }
.blog-page :target { scroll-margin-top: calc(var(--nav-h) + 1.5rem); }

/* ---------- sheet frame (grid paper + double border), shared ---------- */
.sheet-frame {
  position: relative; display: flex; flex-direction: column;
  background-color: var(--zinc);
  background-image:
    linear-gradient(rgba(185,192,195,.55) 1px, transparent 1px), linear-gradient(90deg, rgba(185,192,195,.55) 1px, transparent 1px),
    linear-gradient(rgba(185,192,195,.28) 1px, transparent 1px), linear-gradient(90deg, rgba(185,192,195,.28) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  border: 2px solid var(--graphite);
}
.sheet-frame::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--graphite); pointer-events: none; }
.frame__title { position: relative; display: flex; justify-content: space-between; align-items: center; gap: var(--s2); border-top: 2px solid var(--graphite); background: var(--zinc); padding: .55rem 1rem; font-size: var(--t-small); line-height: 1.5; }
.frame__title span:first-child { font-weight: 600; }
.frame__mark img { height: 22px; width: auto; }

/* ---------- breadcrumbs ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: .5rem; font-size: var(--t-small); color: var(--steel); }
.crumbs a { color: inherit; }
.crumbs a:hover { color: var(--graphite); }
.crumbs [aria-current] { color: var(--graphite); }

/* =========================================================
   LISTING
   ========================================================= */
.bhead { padding-block: var(--s6) var(--s5); }
.bhead__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s3) var(--s6); align-items: end; }
.bhead .crumbs { grid-column: 1 / -1; }
.bhead__title { font-size: clamp(2.8rem, 7vw, 6.4rem); line-height: 1.15; letter-spacing: -.01em; }
.bhead__lead { font-size: var(--t-lead); line-height: 1.8; color: #4C5558; max-width: 30em; padding-bottom: .6rem; }

.search {
  grid-column: 1 / -1; position: relative; display: flex; align-items: center;
  margin-top: var(--s3); background: var(--zinc); border: 2px solid var(--graphite);
  transition: box-shadow .2s;
}
.search:focus-within { box-shadow: 0 0 0 3px rgba(59,184,42,.45); }
.search__icon { width: 26px; height: 26px; margin-inline: 1.2rem .4rem; flex: none; fill: none; stroke: var(--graphite); stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font: 400 clamp(1.05rem, 1.6vw, 1.35rem)/1.4 var(--f-body); color: var(--graphite); padding: 1.15rem .4rem;
}
.search input::placeholder { color: #8C969A; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); cursor: pointer; }
.search__kbd { font: 600 .8rem/1 var(--f-body); border: 1px solid var(--rule); border-bottom-width: 2px; padding: .3rem .55rem; color: var(--steel); margin-inline: .4rem; }
.search__count { flex: none; align-self: stretch; display: grid; place-items: center; padding-inline: 1.3rem; border-right: 2px solid var(--graphite); font-weight: 600; font-size: .95rem; white-space: nowrap; min-width: 7.5rem; }

.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font: 400 .95rem/1.4 var(--f-body); color: var(--graphite); cursor: pointer;
  background: transparent; border: 1px solid #A9B1B5; padding: .45rem .95rem; border-radius: 2px;
  display: inline-flex; gap: .5rem; align-items: center; transition: background-color .2s, color .2s, border-color .2s;
}
.chip span { font-size: .78rem; color: var(--steel); }
.chip:hover { border-color: var(--graphite); }
.chip[aria-pressed="true"] { background: var(--graphite); border-color: var(--graphite); color: var(--zinc); }
.chip[aria-pressed="true"] span { color: #A9B4B8; }

/* featured */
.featured { padding-bottom: var(--s6); }
.feat { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s5); align-items: center; text-decoration: none; color: inherit; }
.feat__sheet .drawing { padding: var(--s4) var(--s4) var(--s2); max-height: 520px; }
.feat__title { font-size: clamp(1.9rem, 3.2vw, 3rem); line-height: 1.35; margin-top: var(--s2); }
.feat__excerpt { margin-top: var(--s3); font-size: var(--t-lead); line-height: 1.85; color: #4C5558; max-width: 30em; }
.feat__more { display: inline-flex; margin-top: var(--s4); font-weight: 600; padding-bottom: .2rem; border-bottom: 2px solid var(--green); }
.feat:hover .feat__title, .feat:focus-visible .feat__title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .25em; }

/* grid + tiles */
.posts { padding-block: var(--s5) var(--s7); scroll-margin-top: var(--nav-h); }
.posts__title { font-size: clamp(1.5rem, 2.4vw, 2.1rem); padding-bottom: var(--s2); margin-bottom: var(--s4); border-bottom: 2px solid var(--graphite); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5) var(--s4); }
.tile[hidden] { display: none; }
.tile__link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.tile__cover { position: relative; aspect-ratio: 4 / 3; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); padding: var(--s3);
  background-color: var(--zinc);
  background-image: linear-gradient(rgba(185,192,195,.45) 1px, transparent 1px), linear-gradient(90deg, rgba(185,192,195,.45) 1px, transparent 1px);
  background-size: 16px 16px; border: 1px solid #A9B1B5; transition: border-color .25s;
}
.tile__cover { overflow: hidden; }
.tile__cover .drawing { width: 100%; height: 100%; min-height: 0; }
.tile__link:hover .tile__cover, .tile__link:focus-visible .tile__cover { border-color: var(--graphite); }
.tile__body { display: flex; flex-direction: column; flex: 1; padding-top: var(--s3); }
.tile__meta { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .85rem; color: var(--steel); line-height: 1.6; }
.tile__cat { color: var(--green-ink); font-weight: 600; }
.tile__title { margin-top: .5rem; font-size: clamp(1.15rem, 1.5vw, 1.35rem); line-height: 1.6; }
.tile__link:hover .tile__title, .tile__link:focus-visible .tile__title { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .3em; }
.tile__excerpt { margin-top: .6rem; font-size: .95rem; line-height: 1.85; color: #4C5558; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile time { margin-top: auto; padding-top: var(--s2); font-size: .85rem; color: var(--steel); }
mark { background: rgba(59,184,42,.3); color: inherit; padding: 0 .08em; border-radius: 1px; }

.empty { text-align: center; padding: var(--s6) var(--s2); display: grid; justify-items: center; gap: var(--s2); }
.empty[hidden] { display: none; }
.empty svg { width: 64px; height: 64px; fill: none; stroke: var(--steel); stroke-width: 1.6; }
.empty__title { font: 600 1.35rem/1.6 var(--f-display); }
.empty__hint { color: #4C5558; }

/* green call to action band (listing + article) */
.bcta { padding-block: var(--s6); }
.bcta__grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr) auto; gap: var(--s3) var(--s5); align-items: center; }
.bcta h2 { font-size: clamp(1.6rem, 2.6vw, 2.4rem); line-height: 1.4; }
.bcta p { font-size: 1.05rem; line-height: 1.8; }

/* =========================================================
   ARTICLE
   ========================================================= */
.ahead { padding-block: var(--s6) 0; }
.ahead__grid { display: grid; gap: var(--s3); max-width: 64rem; }
.ahead__title { font-size: clamp(2.1rem, 4.4vw, 3.9rem); line-height: 1.35; max-width: 18em; }
.ahead__lead { font-size: clamp(1.1rem, 1.5vw, 1.35rem); line-height: 1.9; color: #4C5558; max-width: 36em; }
.ahead__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); padding-top: var(--s3); margin-top: var(--s1); border-top: 1px solid var(--rule); }
.byline { display: flex; align-items: center; gap: .75rem; }
.byline img { width: 34px; height: 34px; padding: 4px; background: var(--zinc); border: 1px solid var(--rule); border-radius: 50%; }
.byline span { display: grid; line-height: 1.5; }
.byline small { color: var(--steel); font-size: .8rem; }
.ahead__facts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0; }
.ahead__facts div { display: grid; line-height: 1.5; padding-right: var(--s3); border-right: 1px solid var(--rule); }
.ahead__facts dt { font-size: .8rem; color: var(--steel); }
.ahead__facts dd { margin: 0; font-weight: 600; font-size: .95rem; }
.ahead__facts a { color: inherit; }
.acover { margin-top: var(--s5); }
.acover .drawing { width: 100%; max-height: min(58vh, 560px); padding: var(--s4) var(--s5) var(--s3); }

.abody { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: var(--s6); align-items: start; padding-block: var(--s6) var(--s6); }
.prose { order: 1; max-width: 44rem; font-size: 1.125rem; line-height: 2.05; }
.aside { order: 2; position: sticky; top: calc(var(--nav-h) + 1.5rem); display: grid; gap: var(--s4); }

.toc summary { list-style: none; font: 600 1rem/1.5 var(--f-display); padding-bottom: .7rem; border-bottom: 2px solid var(--graphite); cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: ""; width: 9px; height: 9px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translateY(-2px); transition: transform .2s; }
.toc[open] summary::after { transform: rotate(135deg) translateY(-2px); }
.toc ol { list-style: persian; padding-right: 1.4rem; margin: .6rem 0 0; }
.toc li { padding: .3rem 0; font-size: .92rem; line-height: 1.7; color: var(--steel); }
.toc li::marker { font-size: .85rem; }
.toc a { color: #4C5558; text-decoration: none; display: block; padding-right: .5rem; margin-right: -.5rem; border-right: 2px solid transparent; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--graphite); }
.toc a.is-active { color: var(--graphite); font-weight: 600; border-right-color: var(--green); }
@media (min-width: 1024px) { .toc summary { pointer-events: none; } .toc summary::after { display: none; } }

.share__label { font-size: .85rem; color: var(--steel); margin-bottom: .6rem; }
.share__row { display: flex; gap: .5rem; }
.share__btn { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #A9B1B5; background: var(--zinc); color: var(--graphite); cursor: pointer; transition: border-color .2s, background-color .2s; }
.share__btn:hover { border-color: var(--graphite); background: #fff; }
.share__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.share__status { min-height: 1.5em; margin-top: .4rem; font-size: .85rem; color: var(--green-ink); }

/* prose components */
.prose > * + * { margin-top: 1.15em; }
.prose h2 { font-size: clamp(1.45rem, 2.1vw, 1.9rem); line-height: 1.5; margin-top: 2.4em; scroll-margin-top: calc(var(--nav-h) + 1.5rem); }
.prose h2 + * { margin-top: .7em; }
.prose h3 { font-size: 1.2rem; line-height: 1.6; margin-top: 1.8em; }
.prose p { max-width: 68ch; }
.prose ul { padding: 0; }
.prose ul li { position: relative; padding-right: 1.5rem; margin-top: .45em; }
.prose ul li::before { content: ""; position: absolute; right: .2rem; top: .85em; width: 7px; height: 7px; background: var(--green); }

.note { background: var(--zinc); border: 1px solid var(--rule); border-right: 4px solid var(--green); padding: 1.1rem 1.4rem; margin-block: 1.8em; }
.note__title { display: flex; align-items: center; gap: .5rem; font: 600 1.05rem/1.6 var(--f-display); margin-bottom: .35rem; }
.note__title svg { width: 20px; height: 20px; fill: none; stroke: var(--green-ink); stroke-width: 2; stroke-linecap: round; }
.note p:not(.note__title) { font-size: 1rem; line-height: 1.95; }

.pull { margin: 2em 0; padding: 0 1.6rem 0 0; border-right: 2px solid var(--graphite); }
.pull p { font: 600 clamp(1.25rem, 1.9vw, 1.6rem)/1.8 var(--f-display); max-width: 30em; }

.table-wrap { overflow-x: auto; margin-block: 1.8em; border-top: 2px solid var(--graphite); border-bottom: 2px solid var(--graphite); }
.table-wrap:focus-visible { outline-offset: 4px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.8; min-width: 34rem; }
.prose thead th { text-align: right; font-weight: 600; padding: .8rem 1rem; border-bottom: 1px solid var(--graphite); background: var(--zinc); }
.prose tbody th { text-align: right; font-weight: 600; padding: .7rem 1rem; white-space: nowrap; }
.prose td { padding: .7rem 1rem; color: #3E474A; }
.prose tbody tr + tr > * { border-top: 1px solid var(--rule); }

.afig { margin: 2.2em 0; }
.afig .sheet-frame { padding: var(--s3) var(--s3) 0; }
.afig .drawing { max-height: 440px; }
.afig__parts { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; margin: var(--s2) 0 0; padding: .7rem .4rem 1rem; border-top: 1px dashed var(--steel); position: relative; }
.afig__parts li { display: flex; align-items: center; gap: .4rem; font-size: .82rem; line-height: 1.4; color: #3E474A; }
.afig__parts i { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border: 1px solid var(--graphite); border-radius: 50%; font: 600 .72rem/1 var(--f-body); font-style: normal; background: #F7F9F9; }
.afig figcaption { margin-top: .8rem; font-size: .92rem; line-height: 1.8; color: #4C5558; }
.afig figcaption b { color: var(--graphite); margin-left: .4rem; }

.steps { list-style: none; padding: 0; margin-block: 1.6em; position: relative; }
.steps::before { content: ""; position: absolute; top: 1.2rem; bottom: 1.2rem; right: 1.15rem; width: 8px; border-inline: 2px solid var(--graphite); background: var(--galv); }
.steps li { position: relative; display: grid; grid-template-columns: 2.6rem 1fr; gap: 1rem; padding-block: .65rem; }
.step__no { position: relative; z-index: 1; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; background: var(--zinc); border: 2px solid var(--graphite); border-radius: 50%; font: 600 1rem/1 var(--f-display); }
.steps li:last-child .step__no { background: var(--green); border-color: var(--green); }
.steps h3 { margin: .35rem 0 0; font-size: 1.08rem; }
.steps p { margin-top: .2rem; font-size: 1rem; line-height: 1.9; color: #4C5558; }

.prose__foot { margin-top: 3em !important; padding-top: var(--s3); border-top: 1px solid var(--rule); }
.ptags { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; }
.ptags li { padding: 0 !important; margin: 0 !important; }
.ptags li::before { display: none; }
.ptags a { display: inline-block; font-size: .85rem; line-height: 1.6; padding: .2em .8em; border: 1px solid var(--rule); background: var(--zinc); color: var(--graphite); text-decoration: none; }
.ptags a:hover { border-color: var(--graphite); }
.disclaimer { margin-top: var(--s3) !important; font-size: .85rem; line-height: 1.9; color: var(--steel); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); padding-block: var(--s6) 0; }
.pager__item { display: grid; gap: .3rem; padding-top: var(--s2); border-top: 2px solid var(--graphite); text-decoration: none; color: inherit; }
.pager__item span { font-size: .85rem; color: var(--steel); }
.pager__item b { font: 600 1.1rem/1.6 var(--f-display); }
.pager__item:hover b { text-decoration: underline; text-underline-offset: .3em; }
.pager__older { text-align: left; }

.related { padding-block: var(--s6) var(--s7); }

/* =========================================================
   HOMEPAGE — latest articles
   ========================================================= */
.latest { padding-block: var(--s7); background: var(--zinc) var(--grain); border-top: 1px solid var(--rule); }
.latest__head { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 4fr) auto; gap: var(--s3) var(--s5); align-items: end; padding-bottom: var(--s4); margin-bottom: var(--s5); border-bottom: 2px solid var(--graphite); }
.latest__head p { color: #4C5558; font-size: var(--t-lead); line-height: 1.8; }
.latest .tile__cover { background-color: #F7F9F9; }

/* footer links (all pages) */
.footer a { text-decoration: none; }
.footer a:hover { color: var(--zinc); text-decoration: underline; text-underline-offset: .3em; }
@media (min-width: 1024px) { .footer__grid { grid-template-columns: minmax(0, 4fr) repeat(4, minmax(0, 2fr)); } }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1023px) {
  .bhead__grid, .feat, .latest__head, .bcta__grid { grid-template-columns: minmax(0, 1fr); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .abody { grid-template-columns: minmax(0, 1fr); gap: var(--s4); padding-top: var(--s4); }
  .aside { order: 0; position: static; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: var(--s3); padding: var(--s3); background: var(--zinc); border: 1px solid var(--rule); }
  .prose { max-width: none; }
  .acover .drawing { padding: var(--s3); }
  .latest__head .btn { justify-self: start; }
}
@media (max-width: 767px) {
  .grid { grid-template-columns: 1fr; gap: var(--s5); }
  .bhead { padding-block: var(--s5) var(--s4); }
  .search__kbd { display: none; }
  .search__count { min-width: 0; padding-inline: .8rem; font-size: .85rem; }
  .search__icon { margin-inline: .8rem .2rem; width: 22px; height: 22px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .feat__sheet .drawing { padding: var(--s3); }
  .aside { grid-template-columns: minmax(0, 1fr); }
  .prose { font-size: 1.06rem; line-height: 2; }
  .pager { grid-template-columns: 1fr; }
  .pager__older { text-align: right; }
  .ahead__facts div { padding-right: var(--s2); }
  .frame__title { font-size: .8rem; }
  .afig .sheet-frame { padding: var(--s2) var(--s2) 0; }
  .afig__parts { display: none; }
  .drawing.is-figure .bal, .drawing.is-figure .bt, .drawing.is-figure .ld, .drawing.is-figure .ldot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .blog-page *, .latest * { transition: none !important; }
}
