/* Bảng cỡ len mới (views/yarn-chart.js). Chỉ tải trên trang này. Dùng biến màu của site.css nên theo đúng bảng màu từng shop. */
.yarn-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.yl-page { padding-bottom: 20px; }
.yl-layout { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .yl-layout { grid-template-columns: minmax(0, 1fr) 230px; } }
.yl-main { min-width: 0; max-width: 820px; }
.yl-hero h1 { margin-top: 6px; }
.yl-sec { margin: 34px 0; scroll-margin-top: calc(var(--header-h) + 14px); }
.yl-sec h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem); }
.yl-sec h2 small { font-size: .62em; color: var(--muted); font-weight: 700; }
.mini-h { font-family: var(--font); font-size: .95rem; font-weight: 800; margin: 18px 0 10px; display: flex; justify-content: space-between; gap: 10px; }
.mini-h a { font-weight: 700; font-size: .9rem; text-decoration: none; }
.term { color: inherit; text-decoration: underline dotted var(--rose-deep) 2px; text-underline-offset: 3px; }
.badge-n, .ball { flex: 0 0 auto; }

/* Thước độ dày */
.yl-sec .ruler-cap { font-family: var(--font); font-size: .9rem; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.ruler-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 6px; }
.ruler-row { display: grid; grid-template-columns: 36px 118px minmax(0, 1fr) 150px; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.ruler-row:hover, .ruler-row:focus-visible { background: var(--tint); color: var(--ink); }
.ruler-row .strand { width: 100%; height: auto; display: block; }
.ruler-name { display: flex; flex-direction: column; line-height: 1.2; }
.ruler-name small { color: var(--muted); font-size: .8rem; }
.ruler-like { font-size: .85rem; color: var(--ink-2); }
.ruler-row.is-plush { background: color-mix(in srgb, var(--rose) 22%, transparent); }
@media (max-width: 640px) {
  .ruler-row { grid-template-columns: 30px 96px minmax(0, 1fr); padding: 4px 6px; gap: 8px; }
  .ruler-row .badge-n { width: 30px; height: 30px; }
  .ruler-like { display: none; }
}

/* Bảng tóm tắt: máy tính là bảng, điện thoại mỗi cỡ một thẻ (không phải vuốt ngang) */
.tbl-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.ytable { width: 100%; border-collapse: collapse; font-size: .94rem; margin: 0; }
.ytable th, .ytable td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.ytable thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--tint-2); }
.ytable tbody tr:last-child > * { border-bottom: 0; }
.ytable th[scope=row] a { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; }
.ytable th[scope=row] span { display: flex; flex-direction: column; line-height: 1.25; }
.ytable th[scope=row] small { font-weight: 600; color: var(--muted); font-size: .8rem; }
.ytable td small { color: var(--muted); }
.ytable td .strand { display: block; width: 96px; height: auto; }
.ytable .col-ami { background: color-mix(in srgb, var(--rose) 18%, transparent); }
.ytable thead .col-ami { color: var(--rose-ink); background: color-mix(in srgb, var(--rose) 35%, var(--tint-2)); }
.ytable tr.is-plush > * { background: color-mix(in srgb, var(--butter) 22%, transparent); }
.ytable .nw { white-space: nowrap; }
@media (max-width: 720px) {
  .ytable thead { display: none; }
  .ytable, .ytable tbody, .ytable tr, .ytable th, .ytable td { display: block; }
  .ytable tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); padding: 10px 12px; gap: 6px 12px; }
  .ytable tbody tr:last-child { border-bottom: 0; }
  .ytable th, .ytable td { border: 0; padding: 0; }
  .ytable th[scope=row] { grid-column: 1 / -1; }
  .ytable td::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .ytable td.col-ami { background: color-mix(in srgb, var(--rose) 22%, transparent); border-radius: 8px; padding: 4px 6px; margin: -4px -6px; }
  .ytable td[data-label='Looks like'] { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
  .ytable td[data-label='Looks like']::before { display: none; }
  .ytable tr.is-plush { background: color-mix(in srgb, var(--butter) 22%, transparent); }
  .ytable tr.is-plush > * { background: none; }
  .ytable tr.is-plush > td.col-ami { background: color-mix(in srgb, var(--rose) 22%, transparent); }
  .ptable td[data-label='Good to know'] { grid-column: 1 / -1; }
}

/* Thẻ từng cỡ */
.wcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; margin: 18px 0; scroll-margin-top: calc(var(--header-h) + 14px); border-top: 6px solid var(--wc); }
.wcard:target { outline: 3px solid var(--rose-deep); outline-offset: 3px; }
.wcard.is-plush { background: linear-gradient(180deg, color-mix(in srgb, var(--wc) 30%, var(--surface)), var(--surface) 220px); }
.wcard-head { display: flex; gap: 14px; align-items: center; }
.wcard-head h3 { margin: 0; font-size: 1.5rem; }
.aka { margin: 0; color: var(--ink-2); font-weight: 700; font-size: .92rem; }
.star-pill { display: inline-block; margin-top: 6px; font-size: .8rem; font-weight: 800; background: var(--ink); color: #fff; padding: .2em .7em; border-radius: 999px; }
.wtag { font-size: 1.02rem; margin: 12px 0 14px; }
.wcard-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 680px) { .wcard-grid { grid-template-columns: 240px minmax(0, 1fr); } }
.wvisual { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-2); }
.wvisual .strand { width: 100%; height: auto; }
.like { margin: 0 0 6px; font-size: .9rem; }
@media (max-width: 679px) {
  .wvisual { display: grid; grid-template-columns: minmax(0, 1fr) 112px; align-items: center; gap: 4px 12px; }
  .wvisual .swatch { grid-column: 2; grid-row: 1 / span 2; width: 112px; height: auto; }
  .wvisual .like { text-align: center; }
}
.wfacts { margin: 0; }
.wfacts > div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 7px 8px; border-bottom: 1px dashed var(--line); }
.wfacts dt { font-weight: 800; font-size: .85rem; color: var(--ink-2); }
.wfacts dd { margin: 0; font-size: .95rem; }
.wfacts dd small { color: var(--muted); }
.wfacts .hl { background: color-mix(in srgb, var(--rose) 22%, transparent); border-radius: 10px; border-bottom-color: transparent; }
@media (max-width: 480px) { .wfacts > div { grid-template-columns: 1fr; gap: 0; } }
.best { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.best li { background: var(--tint); border-radius: 999px; padding: .2em .75em; font-size: .85rem; font-weight: 700; }
.best::before { content: 'Best for'; font-size: .78rem; font-weight: 800; color: var(--muted); align-self: center; margin-right: 2px; text-transform: uppercase; letter-spacing: .04em; }
.more-link { margin: 10px 0 0; font-weight: 800; }

/* Len các hãng */
.yrow { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ycard { display: flex; gap: 12px; background: var(--bg); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; }
.ycard-body { min-width: 0; flex: 1; }
.ycard h4 { font-family: var(--font); font-size: 1.02rem; margin: 0 0 4px; line-height: 1.2; }
.ycard h4 small { display: block; font-size: .78rem; color: var(--muted); font-weight: 700; }
.fav { display: inline-block; font-size: .72rem; font-weight: 800; color: var(--rose-ink); background: color-mix(in srgb, var(--rose) 35%, white); border-radius: 999px; padding: .1em .6em; margin-bottom: 4px; }
.ycard-facts { list-style: none; padding: 0; margin: 0; font-size: .84rem; color: var(--ink-2); }
@media (max-width: 640px) {
  .yrow { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -20px; padding: 0 20px 6px; position: relative; }
  .yrow > * { flex: 0 0 82%; scroll-snap-align: start; }
}

/* Ảnh pattern nhỏ */
.prow { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.pthumb { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; font-size: .8rem; font-weight: 700; line-height: 1.25; }
.pthumb img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
@media (max-width: 640px) { .prow { display: flex; overflow-x: auto; margin: 0 -20px; padding: 0 20px 6px; position: relative; } .pthumb { flex: 0 0 104px; } }

/* Plush 101 */
.plush { background: color-mix(in srgb, #d9c6ef 22%, var(--surface)); border-radius: var(--radius); padding: 20px; }
.plush .prow, .plush .yrow { margin-left: -20px; margin-right: -20px; }
@media (min-width: 641px) { .plush .prow { margin: 0; } }
.plush-hero { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .plush-hero { grid-template-columns: 260px minmax(0, 1fr); align-items: start; } }
.plush-hero img { width: 100%; height: auto; border-radius: 16px; display: block; }
.plush h3 { font-size: 1.15rem; margin-top: 18px; }
.plush .lead { font-size: 1.02rem; }
.tips { padding-left: 1.1em; }
.tips li { margin: .45em 0; }
.fig { width: 100%; height: auto; display: block; color: var(--ink-2); }
.fig-sm { max-width: 360px; margin: 8px auto 0; }
.ptable th[scope=row] { display: flex; gap: 8px; align-items: center; }
.ptable th[scope=row] span { display: flex; flex-direction: column; line-height: 1.2; }
.ptable .used { color: var(--rose-ink) !important; font-weight: 800 !important; }
.ptable td[data-label='Good to know'] { font-size: .86rem; min-width: 200px; }
.by-yarn { display: grid; gap: 4px; margin-top: 8px; grid-template-columns: minmax(0, 1fr); }
.by-yarn > * { min-width: 0; }

/* FAQ + giải thích từ */
.faq-item { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); margin: 8px 0; padding: 0 16px; }
.faq-item summary { cursor: pointer; font-weight: 800; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq-item summary::after { content: '+'; font-size: 1.3rem; line-height: 1; color: var(--rose-deep); }
.faq-item[open] summary::after { content: '–'; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { margin: 0 0 14px; }
.gloss { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin: 0; }
.gloss > div { background: var(--surface); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); scroll-margin-top: calc(var(--header-h) + 14px); }
.gloss > div:target { outline: 3px solid var(--rose-deep); }
.gloss dt { font-weight: 800; }
.gloss dd { margin: 2px 0 0; font-size: .9rem; color: var(--ink-2); }

/* Mục lục: dính bên phải (máy tính) · nút Contents + ↑ (điện thoại) */
.yl-side { display: none; }
@media (min-width: 1100px) { .yl-side { display: block; } }
.toc { position: sticky; top: calc(var(--header-h) + 18px); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px; }
.toc-h { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }
.toc ol, .mtoc-sheet ol { list-style: none; padding: 0; margin: 0; }
.toc a { display: block; padding: 5px 10px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: .9rem; border-left: 3px solid transparent; }
.toc a:hover { background: var(--tint); }
.toc a.on { color: var(--ink); background: var(--tint-2); border-left-color: var(--rose-deep); }
.mtoc { position: fixed; right: 14px; bottom: 16px; z-index: 40; display: none; gap: 8px; align-items: flex-end; flex-direction: row-reverse; }
.mtoc.show { display: flex; }
@media (min-width: 1100px) { .mtoc.show { display: none; } }
.mtoc-btn, .top-btn { border: 0; font: inherit; font-weight: 800; background: var(--ink); color: #fff; border-radius: 999px; padding: .65em 1.05em; box-shadow: var(--shadow); cursor: pointer; }
.top-btn { width: 44px; height: 44px; padding: 0; background: var(--surface); color: var(--ink); }
.mtoc-sheet { position: fixed; left: 12px; right: 12px; bottom: 70px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 16px; }
.mtoc-sheet a { display: block; padding: 9px 4px; font-weight: 800; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
