/* Silk Rummy — content page templates (article, wide, hub, 404).
   Loaded after style.css; uses only its tokens so light and dark mode follow automatically. */

/* ---------- Containers ---------- */
.wrap.w-article { max-width: 776px; }   /* 720px column + gutters */
.wrap.w-toc { max-width: 1080px; }      /* 720 column + 72 gap + 232 sidebar + gutters */
.layout-article main, .layout-wide main { padding-bottom: 72px; }

/* ---------- Hero band ---------- */
.page-hero {
  position: relative; isolation: isolate; overflow: hidden;
  background:
    radial-gradient(ellipse 55% 95% at 92% -15%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 70%),
    radial-gradient(ellipse 40% 70% at 0% 110%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  border-bottom: 1px solid var(--line);
}
/* Faint suit pattern, fading in from the left */
.page-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--gold); opacity: .1;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='black'%3E%3Cpath transform='translate(18 18)' d='M10 1C3 8 1 11 1 13.5a4.5 4.5 0 0 0 7.6 3.2L7.6 21h4.8l-1-4.3A4.5 4.5 0 0 0 19 13.5C19 11 17 8 10 1z'/%3E%3Cpath transform='translate(98 38)' d='M10 19C3 13 1 9.5 1 6.5a4.5 4.5 0 0 1 9-1.5 4.5 4.5 0 0 1 9 1.5C19 9.5 17 13 10 19z'/%3E%3Cpath transform='translate(38 98)' d='M10 0l7.5 10L10 20 2.5 10z'/%3E%3Cg transform='translate(116 112)'%3E%3Ccircle cx='10' cy='5.5' r='4'/%3E%3Ccircle cx='5' cy='12' r='4'/%3E%3Ccircle cx='15' cy='12' r='4'/%3E%3Cpath d='M9 11h2l1.4 9H7.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") 0 0 / 160px 160px repeat,
    linear-gradient(100deg, transparent 30%, #000 90%);
  -webkit-mask-composite: source-in;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='black'%3E%3Cpath transform='translate(18 18)' d='M10 1C3 8 1 11 1 13.5a4.5 4.5 0 0 0 7.6 3.2L7.6 21h4.8l-1-4.3A4.5 4.5 0 0 0 19 13.5C19 11 17 8 10 1z'/%3E%3Cpath transform='translate(98 38)' d='M10 19C3 13 1 9.5 1 6.5a4.5 4.5 0 0 1 9-1.5 4.5 4.5 0 0 1 9 1.5C19 9.5 17 13 10 19z'/%3E%3Cpath transform='translate(38 98)' d='M10 0l7.5 10L10 20 2.5 10z'/%3E%3Cg transform='translate(116 112)'%3E%3Ccircle cx='10' cy='5.5' r='4'/%3E%3Ccircle cx='5' cy='12' r='4'/%3E%3Ccircle cx='15' cy='12' r='4'/%3E%3Cpath d='M9 11h2l1.4 9H7.6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") 0 0 / 160px 160px repeat,
    linear-gradient(100deg, transparent 30%, #000 90%);
  mask-composite: intersect;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .page-hero::before { opacity: .07; } }
:root[data-theme="dark"] .page-hero::before { opacity: .07; }

.page-hero-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 40px; padding-top: 26px; padding-bottom: 44px; }
.page-hero-text { min-width: 0; max-width: 720px; }
.page-hero .crumbs { padding-top: 0; margin-bottom: 26px; }
.page-hero .crumbs span[aria-hidden] { opacity: .55; }
.page-hero .eyebrow { margin-bottom: 12px; display: inline-flex; align-items: center; gap: 10px; }
.page-hero .eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: .7; }
.page-hero h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); line-height: 1.08; letter-spacing: -.022em; margin: 0 0 .38em; text-wrap: balance; }
.page-hero .hero-lead { font-size: clamp(1.08rem, 1.6vw, 1.24rem); line-height: 1.6; color: var(--muted); margin: 0; max-width: 62ch; text-wrap: pretty; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 22px 0 0; font-size: .86rem; font-weight: 600; color: var(--muted); }
.hero-meta > span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta > span::before { content: ""; width: 15px; height: 15px; flex: none; background: var(--gold);
  -webkit-mask: var(--hm-icon) center / contain no-repeat; mask: var(--hm-icon) center / contain no-repeat; }
.hm-read { --hm-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.hm-updated { --hm-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.hm-count { --hm-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='11' height='15' rx='2'/%3E%3Cpath d='M9 3h9a2 2 0 0 1 2 2v12'/%3E%3C/svg%3E"); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-actions .btn.ghost { background: var(--surface); }

/* Decorative card fan (hero + CTA) */
.hero-art, .cta-art { flex: none; overflow: visible; }
.fa-card { fill: var(--surface); stroke: color-mix(in srgb, var(--gold) 45%, var(--line)); stroke-width: 1.2; filter: drop-shadow(0 6px 10px rgb(10 30 22 / .12)); }
.fa-ix { font: 700 15px var(--font); fill: var(--ink); }
.fa-pip { font: 400 44px var(--display); fill: var(--ink); }
.fa-red { fill: var(--red); }
.hero-art { width: 210px; height: auto; display: none; margin-right: 8px; transform: rotate(4deg); opacity: .95; }
@media (min-width: 1100px) { .hero-art { display: block; } }

/* Gentle entrance (decoration only; text is never hidden) */
@media (prefers-reduced-motion: no-preference) {
  .hero-art { animation: ph-fan .8s .1s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes ph-fan { from { opacity: 0; transform: rotate(10deg) translateY(14px); } }

/* ---------- Body layout ---------- */
.page-body { padding-top: 40px; }
.page-main { min-width: 0; }
@media (min-width: 1100px) {
  .page-body.has-toc { display: grid; grid-template-columns: minmax(0, 720px) 232px; gap: 72px; justify-content: space-between; align-items: start; }
}

/* ---------- Table of contents ---------- */
.toc-list { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc-list a { display: block; text-decoration: none; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.toc-list a:hover { color: var(--ink); }

.toc-aside { display: none; }
@media (min-width: 1100px) {
  .toc-aside { display: block; position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; padding: 4px 0 8px; scrollbar-width: thin; }
  .toc-mobile { display: none; }
}
.toc-title { font: 700 .72rem var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 0 0 14px; }
.toc-side .toc-list { border-left: 1px solid var(--line); }
.toc-side .toc-list a { padding: 6px 0 6px 16px; margin-left: -1px; border-left: 2px solid transparent; transition: color .15s, border-color .15s; }
.toc-side .toc-list a.active { color: var(--ink); font-weight: 600; border-left-color: var(--gold); }

.toc-mobile { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; margin: 0 0 32px; box-shadow: var(--shadow-sm); }
.toc-mobile summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 13px 44px 13px 18px; font-weight: 700; position: relative; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: ""; position: absolute; right: 19px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: translateY(-70%) rotate(45deg); transition: transform .2s; }
.toc-mobile[open] summary::after { transform: translateY(-25%) rotate(-135deg); }
.toc-count { font-size: .8rem; font-weight: 600; color: var(--muted); }
.toc-mobile nav { padding: 0 18px 14px; border-top: 1px solid var(--line); }
.toc-mobile .toc-list { counter-reset: toc; padding-top: 8px; }
.toc-mobile .toc-list li { counter-increment: toc; }
.toc-mobile .toc-list a { display: flex; gap: 12px; padding: 7px 0; font-size: .95rem; color: var(--ink); }
.toc-mobile .toc-list a::before { content: counter(toc, decimal-leading-zero); font: 700 .78rem/1.75 var(--font); color: var(--gold); font-variant-numeric: tabular-nums; flex: none; }
.toc-mobile .toc-list a.active { color: var(--accent); }

/* ---------- Prose typography ---------- */
.prose { font-size: 1.04rem; line-height: 1.75; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-size: clamp(1.5rem, 2.8vw, 1.95rem); margin: 2.3em 0 .6em; scroll-margin-top: 96px; text-wrap: balance; }
.prose h2::before { content: ""; display: block; width: 36px; height: 2px; border-radius: 2px; margin-bottom: .75em;
  background: linear-gradient(90deg, var(--gold), color-mix(in srgb, var(--gold) 25%, transparent)); }
.prose > h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.24rem; margin: 1.9em 0 .45em; }
.prose h2 + h3 { margin-top: .8em; }
.prose strong, .prose b { font-weight: 700; color: var(--ink); }
.prose a:not(.btn):not(.tile) { text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.prose a:not(.btn):not(.tile):hover { text-decoration-color: currentColor; }
.prose ul, .prose ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.prose li { margin: .5em 0; padding-left: .25em; }
.prose li > ul, .prose li > ol { margin: .4em 0 0; }
.prose ol > li::marker { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.prose ul > li::marker { font-size: 1.1em; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--gold); font: italic 600 1.2rem/1.5 var(--display); color: var(--ink); }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.4em 0; }
.prose .table-wrap { margin: 1.6em 0 1.8em; }
.prose th, .prose td { padding: 12px 16px; }
.prose tr > th:first-child:not(:only-child) { white-space: nowrap; }
.prose tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.prose .callout { position: relative; margin: 1.8em 0; padding: 18px 22px 18px 24px; border-left-width: 3px; border-left-color: var(--gold); }
.prose .callout.ok { border-left-color: var(--ok); }
.prose .callout.warn { border-left-color: var(--bad); }
.prose .callout p { max-width: none; }
.prose details.faq { margin: 0 0 10px; transition: border-color .2s, box-shadow .2s; }
.prose details.faq:hover { border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }
.prose details.faq[open] { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: var(--shadow); }
.prose details.faq summary { line-height: 1.45; }
.prose details.faq > p { color: var(--muted); }
.prose details.faq + :not(details) { margin-top: 1.6em; }
.prose img { display: block; margin: 1.8em auto; }
/* Card chips sit on the text baseline */
.prose .hand { vertical-align: baseline; margin: 0 .08em; }
.prose li .hand, .prose td .hand { margin-top: 1px; margin-bottom: 1px; }
.prose p > .btn, .prose p > .btn + .btn { margin: 4px 8px 4px 0; }

/* Hubs: same typography, wider canvas */
.prose-hub > p:not(.lead), .prose-hub > ul, .prose-hub > ol, .prose-hub > .callout, .prose-hub > details.faq { max-width: 780px; }
.prose-hub .grid-cards { margin: 1.4em 0 2em; }

@media (max-width: 640px) {
  .page-hero-inner { padding-top: 18px; padding-bottom: 32px; }
  .page-hero .crumbs { margin-bottom: 20px; }
  .page-body { padding-top: 28px; }
  .prose { font-size: 1rem; line-height: 1.72; }
  .prose h2 { margin-top: 2em; }
  .prose th, .prose td { padding: 10px 12px; }
}

/* ---------- Premium tiles (hubs, wide pages, related, 404) ---------- */
:is(.page-hub, .layout-wide, .related) a.tile {
  display: flex; flex-direction: column; overflow: hidden; isolation: isolate; border-radius: 20px; padding: 24px 24px 22px; min-height: 170px;
  background:
    linear-gradient(90deg, var(--gold-lo), var(--gold-hi)) top left / 0 2px no-repeat,
    linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 100%);
  transition: transform .2s, box-shadow .2s, border-color .2s, background-size .35s ease;
}
:is(.page-hub, .layout-wide, .related) a.tile:hover { background-size: 100% 2px, auto; }
:is(.page-hub, .layout-wide, .related) a.tile::before {
  content: "♠"; position: absolute; right: -4px; bottom: -34px; z-index: -1; pointer-events: none;
  font: 400 7.5rem/1 var(--display); color: var(--gold); opacity: .07; transition: transform .35s ease, opacity .35s ease;
}
:is(.page-hub, .layout-wide, .related) a.tile:nth-child(4n+2)::before { content: "♥"; color: var(--red); opacity: .05; }
:is(.page-hub, .layout-wide, .related) a.tile:nth-child(4n+3)::before { content: "♦"; color: var(--red); opacity: .05; }
:is(.page-hub, .layout-wide, .related) a.tile:nth-child(4n+4)::before { content: "♣"; }
:is(.page-hub, .layout-wide, .related) a.tile:hover::before { opacity: .11; transform: rotate(-8deg) translateY(-4px); }
:is(.page-hub, .layout-wide, .related) .tile .tag {
  align-self: flex-start; padding: 3px 10px; margin-bottom: 14px; border-radius: 999px; font-size: .68rem; letter-spacing: .12em;
  background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 72%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--gold) 25%, transparent);
}
:is(.page-hub, .layout-wide, .related) .tile h3 { font-size: 1.2rem; line-height: 1.25; margin: 0 0 8px; text-wrap: balance; }
:is(.page-hub, .layout-wide, .related) .tile p { max-width: none; }
.tile-go { margin-top: auto; padding-top: 14px; font-size: .85rem; font-weight: 700; color: var(--accent); }
.tile-go::after { content: " →"; transition: margin .2s; }
a.tile:hover .tile-go::after { margin-left: 4px; }
.related a.tile::after { display: none; } /* the "Read guide →" line replaces the corner arrow */

/* ---------- End-of-page blocks ---------- */
.page-end { margin-top: 56px; }

.cta-card {
  position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 34px 36px; border-radius: 22px; border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--line));
  background:
    radial-gradient(ellipse 60% 120% at 100% 0%, color-mix(in srgb, var(--gold) 20%, transparent), transparent 65%),
    linear-gradient(135deg, var(--surface) 0%, var(--bg-2) 100%);
  box-shadow: var(--shadow);
}
.cta-body { min-width: 0; max-width: 520px; }
.cta-card .eyebrow { margin-bottom: 8px; }
.cta-card h2 { font-size: clamp(1.45rem, 2.8vw, 1.85rem); margin: 0 0 .4em; }
.cta-card p { margin: 0 0 20px; color: var(--muted); line-height: 1.6; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cta-actions .btn.ghost { background: var(--surface); }
.cta-pledges { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.cta-pledges li { display: inline-flex; align-items: center; gap: 6px; }
.cta-pledges li::before { content: ""; width: 12px; height: 7px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: translateY(-2px) rotate(-45deg); }
.cta-art { width: 170px; height: auto; margin: -10px -6px -24px 0; transform: rotate(6deg); }
@media (max-width: 680px) {
  .cta-card { padding: 26px 20px 24px; }
  .cta-art { display: none; }
}
@media (max-width: 420px) { .cta-actions .btn { flex: 1 1 100%; } }

.related { margin-top: 56px; }
.related-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.related-head h2 { margin: 0; font-size: clamp(1.35rem, 2.4vw, 1.6rem); }
.related-head a { font-size: .9rem; font-weight: 700; text-decoration: none; }
.related-head a:hover { text-decoration: underline; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.related .tile p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; font-size: .9rem; }
.related a.tile { min-height: 0; padding: 22px 22px 20px; }
.related .tile h3 { font-size: 1.1rem; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 32px; padding-top: 32px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; gap: 3px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); transition: border-color .18s, transform .18s, box-shadow .18s; min-width: 0; }
.pager a:hover { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); box-shadow: var(--shadow); transform: translateY(-2px); }
.pager span { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.pager b { font: 600 1.05rem/1.3 var(--display); }
.pager-prev span::before { content: "← "; }
.pager-next { text-align: right; align-items: flex-end; }
.pager-next span::after { content: " →"; }
@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; align-items: flex-start; }
}

/* Wide pages: give tool widgets and hubs breathing room under the hero */
.layout-wide .page-body > .prose { max-width: 780px; }
.layout-wide .page-end { max-width: none; }
.page-404 .page-body .grid-cards { margin-top: 8px; }

/* ---------- Print ---------- */
@media print {
  .page-hero { background: none; border: 0; }
  .page-hero::before, .hero-art, .hero-meta, .page-hero .eyebrow, .toc, .toc-aside, .page-end { display: none !important; }
  .layout-wide .page-hero { display: none; } /* tools print their own sheet heading */
  .page-body { padding-top: 0; display: block !important; }
}
