/* Note: gross vs take-home pay. One payslip stage; the rest reads like the other notes. */

/* Hero: base salary -> gross earnings -> net pay */
.pay-chain { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(16px, 2.6vw, 32px); margin-top: 30px; }
.pc { display: grid; align-content: start; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line-strong); }
.pc-net { border-top-color: var(--accent); }
.pc-op { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: var(--fs-micro); font-weight: 600; color: var(--accent); }
.pc-glyph { width: 18px; height: 18px; padding: 2px; border-radius: 50%; background: var(--accent-tint); stroke-width: 2.2; }
.pc:first-child { padding-top: 14px; }
.pc:first-child::before { content: ''; height: calc(1.3em + 4px); }
.pc-term { font-family: var(--display); font-size: 1.3rem; font-weight: 650; line-height: 1.25; letter-spacing: -.01em; }
:lang(th) .pc-term { letter-spacing: 0; font-weight: 600; line-height: 1.4; }
.pc-net .pc-term { color: var(--accent); }
.pc-alt { font-size: var(--fs-micro); color: var(--ink-2); }
.pc-def { margin-top: 4px; font-size: var(--fs-small); line-height: 1.6; color: var(--ink-2); }
.pay-chain-note { margin-top: 14px; font-size: var(--fs-small); color: var(--ink-2); }
.pay-short { margin-top: 26px; padding: 18px 22px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--sh-1); line-height: 1.7; max-width: none; }
.pay-short strong { color: var(--accent); margin-right: 4px; }
.article-meta a { color: var(--accent); }

/* The stage */
.pay-demo { margin-top: clamp(48px, 6vw, 80px); padding-block: clamp(44px, 6vw, 84px); background: var(--tint); }
.pay-wrap { max-width: calc(1080px + 2 * var(--gutter)); }
.pay-demo-head h2 { font-family: var(--display); font-weight: 650; font-size: 1.6rem; letter-spacing: -.015em; }
:lang(th) .pay-demo-head h2 { letter-spacing: 0; font-weight: 600; }
.pay-demo-head p { margin-top: 8px; color: var(--ink-2); max-width: 62ch; }
.pay-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; border: 0; }
.pay-pick[hidden] { display: none; }
.pay-chip { position: relative; }
.pay-chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pay-chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: var(--fs-small); font-weight: 500; color: var(--ink); transition: background-color var(--d-fast) var(--ease-out), color var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out); }
.pay-chip input:hover + span { box-shadow: inset 0 0 0 1px var(--ink-2); }
.pay-chip input:checked + span { background: var(--ink); color: var(--on-dark); box-shadow: none; }
.pay-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.pay-stage { display: grid; grid-template-columns: minmax(0, 430px) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; margin-top: 26px; }
.slip { margin: 0; padding: 24px 26px 22px; border-radius: 10px; background: var(--surface); box-shadow: var(--sh-2); }
.slip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px dashed var(--line-strong); font-size: var(--fs-micro); color: var(--ink-2); }
.slip-head strong { font-size: var(--fs-small); color: var(--ink); text-align: right; }
.slip-lines { display: grid; }
.sl { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-inline: -10px; padding: 9px 10px; border-radius: 8px; transition: background-color var(--d-mid) var(--ease-out); }
.sl dt { font-size: var(--fs-small); color: var(--ink-2); }
.sl dd { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sl-minus dd { color: var(--ink-2); font-weight: 500; }
.sl.is-sum { margin-top: 4px; border-radius: 0 0 8px 8px; box-shadow: inset 0 1px 0 var(--line-strong); }
.sl.is-sum dt { color: var(--ink); font-weight: 600; }
.sl.is-net { margin-top: 6px; border-radius: 0 0 8px 8px; box-shadow: inset 0 2px 0 var(--ink); padding-top: 12px; }
.sl.is-net dt { color: var(--ink); font-weight: 700; }
.sl.is-net dd { font-family: var(--display); font-size: 1.45rem; font-weight: 700; color: var(--accent); }
.sl.is-hl, .slip-bank.is-hl { background: var(--accent-tint); }
.slip-bank { margin: 14px -10px 0; padding: 12px 10px 4px; border-top: 1px dashed var(--line-strong); border-radius: 0 0 8px 8px; transition: background-color var(--d-mid) var(--ease-out); }
.slip-bank p { font-size: var(--fs-micro); color: var(--ink-2); }
.slip-bank ul { margin: 0; padding: 0; list-style: none; }
.slip-bank li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; font-size: var(--fs-small); }
.slip-bank b { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

.pay-side { display: grid; gap: 20px; align-content: start; }
.pay-bars { display: grid; gap: 10px; }
.pb { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px; }
.pb-label { font-size: var(--fs-micro); color: var(--ink-2); }
/* Segments are full-width layers cut with clip-path: no layout work while they move. --x is the start, --w the length (% of the largest month). */
.pb-track { position: relative; height: 18px; border-radius: 6px; background: color-mix(in srgb, var(--surface) 70%, transparent); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.pb-seg { position: absolute; inset: 0; --x: 0; clip-path: inset(0 calc(100% - (var(--x) + var(--w)) * 1%) 0 calc(var(--x) * 1%)); transition: clip-path 700ms var(--ease-out); }
.pb-base, .k-base { background: var(--ink-2); }
.pb-add, .k-add { background: var(--accent-soft); }
.pb-net, .k-net { background: var(--accent); }
.pb-ded, .k-ded { background: repeating-linear-gradient(135deg, var(--ink-2) 0 3px, transparent 3px 6px); }
.pb-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 2px; padding-left: 108px; font-size: var(--fs-micro); color: var(--ink-2); }
.pb-legend li { display: inline-flex; align-items: center; gap: 6px; }
.k { display: inline-block; width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent); }
.pay-bars.is-off .pb-track { opacity: .35; }
.pay-note { font-size: 1.05rem; line-height: 1.65; min-height: 5em; }
:lang(th) .pay-note { line-height: 1.8; }
.pay-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: var(--fs-small); }
.pay-sum span { font-size: var(--fs-micro); color: var(--ink-2); }
.pay-sum output { font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-employer { padding-top: 16px; border-top: 1px solid var(--line-strong); }
.pe-h { font-size: var(--fs-small); font-weight: 600; }
.pay-employer dl { display: grid; gap: 2px; margin-top: 8px; }
.pay-employer dl div { display: flex; justify-content: space-between; gap: 16px; font-size: var(--fs-small); color: var(--ink-2); }
.pay-employer dd { font-variant-numeric: tabular-nums; }
.pe-note { margin-top: 8px; font-size: var(--fs-micro); color: var(--ink-2); line-height: 1.6; }
.pay-assume { margin-top: 26px; max-width: 92ch; font-size: var(--fs-micro); line-height: 1.7; color: var(--ink-2); }

/* Reading sections */
.pay-body .article-section h3 { margin-top: 26px; font-family: var(--display); font-size: 1.2rem; font-weight: 650; line-height: 1.35; }
:lang(th) .pay-body .article-section h3 { font-weight: 600; }
.pay-more { margin-top: 14px; }
.pay-more .disclose-r { margin-top: 0; border-top: 1px solid var(--line); }
.pay-more .disclose-r:last-child { border-bottom: 1px solid var(--line); }
.pay-more summary { display: flex; align-items: center; min-height: 52px; cursor: pointer; list-style: none; }
.pay-more summary::-webkit-details-marker { display: none; }
.pay-more summary::after { content: '+'; margin-left: auto; padding-left: 16px; color: var(--accent); font-size: 1.3rem; }
.pay-more details[open] summary::after { content: '−'; }
.pay-more summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.pay-body .pay-more summary h3 { margin: 0; font-family: var(--text); font-size: 1.05rem; font-weight: 600; }
.pay-more details > p { padding: 0 0 18px; max-width: 66ch; color: var(--ink-2); }
.pay-ded { margin-top: 30px; }
.pay-qa { margin-top: 10px; }
.pay-qa > div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 6px 20px; padding: 12px 0; border-top: 1px solid var(--line); }
.pay-qa dt { font-size: var(--fs-small); font-weight: 600; color: var(--ink-2); }
.pay-pairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin-top: 10px; }
.pay-pairs > div { padding: 14px 0; border-top: 1px solid var(--line); }
.pay-pairs dt { font-weight: 600; }
.pay-pairs dd { margin-top: 4px; font-size: var(--fs-small); color: var(--ink-2); line-height: 1.65; }
.pay-hint { display: none; }
.pay-table-wrap { position: relative; margin-top: 16px; } /* contains the hidden button labels so they scroll with the table */
.pay-table-wrap + p { margin-top: 18px; }
.pay-table { min-width: 600px; }
.pay-table caption { caption-side: top; padding: 14px 18px 4px; text-align: left; font-size: var(--fs-micro); color: var(--ink-2); }
.pay-table th[scope='row'] { font-weight: 500; color: var(--ink-2); background: var(--surface); }
.pay-table thead th { vertical-align: bottom; }
.pay-table td { text-align: right; white-space: nowrap; }
.th-name { display: block; color: var(--ink); font-size: var(--fs-small); }
.t-kind { display: block; font-size: var(--fs-micro); color: var(--ink-2); font-weight: 400; }
.pay-table tr.is-sum td { font-weight: 600; }
.pay-table tr.is-net td { font-weight: 700; color: var(--accent); }
.pay-table .is-cur { background: var(--accent-tint); }
.pay-show { min-height: 32px; margin-top: 4px; padding: 0; font-size: var(--fs-micro); font-weight: 600; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.pay-show:hover { color: var(--accent-hover); }
.pay-scen { margin-top: 18px; }
.pay-scen > div { padding: 12px 0; border-top: 1px solid var(--line); }
.pay-scen dt { font-weight: 600; }
.pay-scen dd { margin-top: 4px; color: var(--ink-2); line-height: 1.7; }
.pay-check { counter-reset: chk; display: grid; margin-top: 14px; }
.pay-check li { counter-increment: chk; position: relative; display: grid; gap: 2px; padding: 12px 0 12px 44px; border-top: 1px solid var(--line); }
.pay-check li::before { content: counter(chk); position: absolute; left: 0; top: 12px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); font-size: .8rem; font-weight: 700; }
.pay-check span { font-size: var(--fs-small); color: var(--ink-2); }
.pay-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.pay-tools a { display: grid; gap: 6px; height: 100%; padding: 18px 20px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--sh-1); text-decoration: none; color: var(--ink); transition: box-shadow var(--d-mid) var(--ease-out), transform var(--d-mid) var(--ease-out); }
.pay-tools a:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.pay-tools strong { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--accent); }
.pay-tools span { font-size: var(--fs-small); color: var(--ink-2); line-height: 1.6; }
.pay-faq h3 { margin-top: 22px; }
.pay-faq p { margin-top: 6px; max-width: 68ch; }
.pay-src-note { font-size: var(--fs-small); color: var(--ink-2); }
.pay-sources { display: grid; margin-top: 12px; padding-left: 1.4em; list-style: decimal; }
.pay-sources li { padding: 10px 0 10px 4px; border-bottom: 1px solid var(--line); }
.pay-sources li:target { background: var(--accent-tint); }
.pay-sources a { color: var(--accent); font-weight: 500; }
.pay-sources span { display: block; margin-top: 2px; font-size: var(--fs-micro); color: var(--ink-2); }
.cite-n { white-space: nowrap; }
.cite-n a { margin-left: 1px; font-size: max(.78em, 12px); vertical-align: super; line-height: 0; color: var(--accent); text-decoration: none; }
.cite-n a:hover, .cite-n a:focus-visible { text-decoration: underline; }

@media (max-width: 860px) {
  .pay-stage { grid-template-columns: minmax(0, 1fr); }
  .pay-note { min-height: 0; }
}
@media (max-width: 720px) {
  .pay-chain { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .pc:first-child::before { display: none; }
  .pay-qa > div, .pay-pairs, .pay-tools { grid-template-columns: minmax(0, 1fr); }
  .pay-hint { display: block; margin-top: 12px; font-size: var(--fs-micro); color: var(--ink-2); }
  .pay-table th[scope='row'] { position: sticky; left: 0; z-index: 1; min-width: 128px; box-shadow: 1px 0 0 var(--line-strong); }
  .slip { padding: 20px 18px 18px; }
  .pb { grid-template-columns: 76px minmax(0, 1fr); }
  .pb-legend { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pb-seg, .sl, .slip-bank, .pay-chip span, .pay-tools a { transition: none; }
}
