/* Work card "コマ" (MANGA-WORK-CARD-20261118-01). Markup: work-card.php.
   The layout follows each card's own width (container query on .mqw-cell), not the screen width:
   - card < 460px: cover 124–156px, buttons across the full width under the cover;
   - card >= 460px: cover 172px, buttons at the bottom of the right column.
   Fonts: Dela Gothic One (title, score, buttons) + Zen Maru Gothic (text), loaded only where cards appear. */

.mqw-cell { --mqw-ink: #1d2326; --mqw-paper: #fff; --mqw-yellow: #ffd84d; --mqw-yellow-d: #f4b400; --mqw-cream: #fff6cc;
  --mqw-green: #bfe9cc; --mqw-orange: #ffc9ad; --mqw-text: #333; --mqw-muted: #5f6b67; --mqw-star: #ffb800;
  --mqw-head: "Dela Gothic One", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
  --mqw-body: "Zen Maru Gothic", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Noto Sans JP", sans-serif;
  container-type: inline-size; min-width: 0; width: 100%; }

/* Grids: full cards in up to --mqw-cols columns, each at least 420px wide (one column, max 560px, when narrower). */
.mqw-grid { display: grid; gap: 22px 18px; }
.mqw-grid--full { justify-items: center;
  grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 420px), calc((100% - (var(--mqw-cols, 2) - 1) * 18px) / var(--mqw-cols, 2))), 1fr)); }
.mqw-grid--full .mqw-cell { max-width: 560px; }
.mqw-grid--compact { grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 680px; margin-inline: auto; }

/* ---------- full card ---------- */
.mqw { position: relative; box-sizing: border-box; display: grid; height: 100%; margin: 0; color: var(--mqw-text); font-family: var(--mqw-body); line-height: 1.6; text-align: left;
  grid-template-columns: clamp(124px, 36cqi, 156px) minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "head head" "cover body" "foot foot";
  gap: 10px 14px; padding: 12px 14px 14px;
  border: 3px solid var(--mqw-ink); border-radius: 4px; outline: 1.5px solid var(--mqw-ink); outline-offset: -8px; box-shadow: 5px 5px 0 var(--mqw-ink);
  background: linear-gradient(180deg, var(--mqw-paper) 55%, rgba(255, 255, 255, 0) 100%), radial-gradient(circle, var(--mqw-yellow-d) 1.5px, transparent 1.8px) 0 0 / 10px 10px, var(--mqw-cream); }
.mqw *, .mqw *::before, .mqw *::after { box-sizing: border-box; }

/* Reset SWELL article styles (headings, paragraphs, links) inside the card. */
.mqb .mqw p, .post_content .mqw p { margin: 0; padding: 0; }
.mqw a, .post_content .mqw a { color: inherit; text-decoration: none; }
.mqb .mqw .mqw__title, .post_content .mqb .mqw .mqw__title { margin: 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; text-align: left; letter-spacing: normal; }
.mqb .mqw .mqw__title::before, .mqb .mqw .mqw__title::after, .post_content .mqb .mqw .mqw__title::before, .post_content .mqb .mqw .mqw__title::after { content: none; display: none; }

.mqw__head { grid-area: head; min-width: 0; padding: 2px 4px 8px; border-bottom: 2px dashed var(--mqw-ink); }
/* Title: one line; a longer title ends with "…" (full title in the title attribute and the link text). */
.mqb .mqw .mqw__title { display: block; font-family: var(--mqw-head); font-weight: 400; font-size: clamp(19px, 7cqi, 22px); line-height: 1.3; color: var(--mqw-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mqw__title a { color: var(--mqw-ink) !important; }
.mqw__author { margin-top: 2px !important; font-size: 12.5px; font-weight: 500; line-height: 1.5; color: var(--mqw-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mqw__cover { grid-area: cover; align-self: start; display: block; position: relative; line-height: 0; border: 2px solid var(--mqw-ink); box-shadow: 4px 4px 0 var(--mqw-ink); background: var(--mqw-paper); transform: rotate(-1.5deg); }
.mqw__cover img { display: block; width: 100%; height: auto; max-width: none; margin: 0; border-radius: 0; box-shadow: none; }
.mqw__noimg { display: grid; place-items: center; width: 100%; aspect-ratio: 7 / 10; font-size: 12px; line-height: 1.4; color: var(--mqw-muted); background: #f1f3f2; }

/* Score + catch at the top, tags at the bottom next to the buttons, so the space beside the cover is shared out. */
.mqw__body { grid-area: body; display: flex; flex-direction: column; gap: 7px; min-width: 0; padding-top: 2px; }
.mqw__rate { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.mqw__rate--none { font-size: 13px; font-weight: 700; color: var(--mqw-muted); }
.mqw__num { font-family: var(--mqw-head); font-weight: 400; font-size: 34px; line-height: 1; color: var(--mqw-yellow); -webkit-text-stroke: 2.5px var(--mqw-ink); paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--mqw-ink); transform: rotate(-4deg); font-variant-numeric: tabular-nums; padding: 2px 4px 4px 0; }
.mqw__num small { font-size: 15px; -webkit-text-stroke-width: 2px; text-shadow: 2px 2px 0 var(--mqw-ink); margin-left: 2px; }
@supports not (paint-order: stroke) { .mqw__num, .mqw__num small { color: var(--mqw-ink); -webkit-text-stroke: 0; text-shadow: none; } }
.mqw__stars { display: inline-flex; gap: 2px; line-height: 0; }
.mqw__star { position: relative; display: block; width: 16px; height: 16px; }
.mqw__star svg { display: block; width: 100%; height: 100%; }
.mqw__star > span { position: absolute; inset: 0 auto 0 0; width: var(--f); overflow: hidden; }
.mqw__star > span svg { width: 16px; }
.mqw__star polygon { fill: var(--mqw-paper); stroke: var(--mqw-ink); stroke-width: 1.8; stroke-linejoin: round; }
.mqw__star > span polygon { fill: var(--mqw-star); }
.mqw__catch { font-size: 13.5px; font-weight: 500; line-height: 1.6; color: var(--mqw-text); }
.mqw__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 4px; }
.mqw__tags span { font-weight: 700; font-size: 11.5px; line-height: 1.5; padding: 1px 8px; border: 1.5px solid var(--mqw-ink); border-radius: 99px; background: var(--mqw-cream); color: var(--mqw-ink); white-space: nowrap; }
.mqw__tags .mqw__tag-done { background: var(--mqw-ink); color: var(--mqw-yellow); }
.mqw__tags .mqw__tag-on { background: var(--mqw-green); }
.mqw__tags .mqw__tag-vol { background: var(--mqw-paper); }

/* Two buttons of the same size; text never wraps. */
.mqw__foot { grid-area: foot; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-self: end; margin-top: 2px; }
.mqw__btn { display: grid; place-items: center; align-content: center; min-height: 48px; padding: 7px 10px; border: 2px solid var(--mqw-ink); border-radius: 6px; color: var(--mqw-ink) !important;
  text-align: center; white-space: nowrap; background: var(--mqw-green); box-shadow: 2px 2px 0 var(--mqw-ink); transition: transform .12s, box-shadow .12s; }
.mqw__btn b { font-family: var(--mqw-head); font-weight: 400; font-size: 15px; line-height: 1.3; }
.mqw__btn small { font-weight: 700; font-size: 11px; line-height: 1.35; }
.mqw__btn--imp { background: var(--mqw-orange); }
a.mqw__btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--mqw-ink); }
.mqw__btn.is-none { background: #f1f3f2; color: #6f7975 !important; box-shadow: none; border-style: dashed; border-color: #b9c1bd; }

@container (min-width: 460px) {
  .mqw { grid-template-columns: 172px minmax(0, 1fr); grid-template-rows: auto 1fr auto; grid-template-areas: "head head" "cover body" "cover foot"; gap: 10px 16px; padding: 14px 16px 16px; }
  .mqb .mqw .mqw__title { font-size: 25px; }
  .mqw__author { font-size: 13px; }
  .mqw__body { gap: 8px; }
  .mqw__num { font-size: 40px; }
  .mqw__num small { font-size: 17px; }
  .mqw__star { width: 18px; height: 18px; }
  .mqw__star > span svg { width: 18px; }
  .mqw__catch { font-size: 14.5px; line-height: 1.65; }
  .mqw__tags span { font-size: 12px; padding: 1px 9px; }
  .mqw__foot { margin-top: 0; }
}

/* ---------- compact card (ranking, "次に読む作品"): the whole card is one link ---------- */
.mqw--compact { grid-template-columns: 82px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "cover head" "cover body"; gap: 6px 14px; padding: 12px 14px; color: var(--mqw-text) !important; }
.mqw--compact .mqw__head { align-self: end; border-bottom: 0; padding: 4px 0 0; }
.mqw--compact.has-rank .mqw__head { padding-right: 30px; }
.mqb .mqw--compact .mqw__title, .mqw--compact .mqw__title { display: block; font-family: var(--mqw-head); font-size: 20px; line-height: 1.3; color: var(--mqw-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mqw--compact .mqw__cover { align-self: center; }
.mqw--compact .mqw__body { align-self: start; gap: 4px; padding-top: 0; }
.mqw--compact .mqw__num { font-size: 28px; }
.mqw--compact .mqw__num small { font-size: 13px; }
.mqw--compact .mqw__star { width: 15px; height: 15px; }
.mqw--compact .mqw__star > span svg { width: 15px; }
.mqw--compact .mqw__catch { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.mqw--compact:hover { background: var(--mqw-cream); }
@container (min-width: 460px) { .mqw--compact { grid-template-columns: 82px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "cover head" "cover body"; gap: 6px 14px; padding: 12px 14px; }
  .mqb .mqw--compact .mqw__title { font-size: 20px; }
  .mqw--compact .mqw__num { font-size: 28px; } .mqw--compact .mqw__num small { font-size: 13px; }
  .mqw--compact .mqw__star { width: 15px; height: 15px; } .mqw--compact .mqw__star > span svg { width: 15px; } }

.mqw__rank { position: absolute; z-index: 2; right: -12px; top: -14px; width: 42px; height: 42px; display: grid; place-items: center; font: 400 17px/1 var(--mqw-head); color: var(--mqw-ink); background: #e7ecef;
  clip-path: polygon(50% 0, 61% 22%, 85% 10%, 78% 36%, 100% 50%, 78% 64%, 85% 90%, 61% 78%, 50% 100%, 39% 78%, 15% 90%, 22% 64%, 0 50%, 22% 36%, 15% 10%, 39% 22%); }
.mqw__rank--1 { background: #ffc400; } .mqw__rank--2 { background: #cfd6dc; } .mqw__rank--3 { background: #e0a26b; }

.mqw a:focus-visible, a.mqw:focus-visible { outline: 3px solid #216660; outline-offset: 2px; }
