/*
 * The new site's own looks, on top of the theme's stylesheets (the design desk, branch design).
 *
 * The theme's files (public/wp-content/themes/…, theme/templates) are copied afresh from WordPress by
 * scripts/sync-theme.sh, so a change of looks asked for on the new site lives here instead: this file is linked
 * as the last stylesheet of every page's head when the page is served (src/lib/rewrite.mjs, with a mark in its
 * address that changes when the file does). Wording and markup cannot be changed from here: those are exact-text
 * patches in scripts/theme-patches.mjs.
 *
 * Rules: one block per request, with its date and the owner's words; a request made on the desktop layout stays
 * inside @media (min-width: 1024px), one made on the phone inside @media (max-width: 1023px); selectors a notch
 * more specific than the theme's, never !important. Each block is also a line in PLAN.md ("Where the new site
 * differs from WordPress on purpose").
 */

/* The page's own white. The theme gives neither html nor body a background, so pages without a coloured section
   (categories, articles) showed whatever lies behind the page: white in ordinary browsers, but dark in a viewer
   that puts a dark backing behind pages (seen in the preview pane, 18 Nov 2026 - ink headings on black). */
html { background-color: #fff; }

/* 18 Nov 2026, the owner: "เราอยากเพิ่มความ Grainy Gradients ให้กับเว็บไซต์แบบเวอร์ชั่นสว่าง และสีไม่หลุดธีม". Light
   grainy gradients in the brand's own colours, on both layouts:
   - the page itself: a very light blue-white with a soft blue glow at the top left and a soft orange one at the
     top right (brand blue #004aeb and orange #fe9300 at about 13%), under a fine ink-coloured grain;
   - the home page and the credit cards page keep their own backdrop and get the same grain;
   - the coloured bands at the top of pages (home hero, category, articles, credit cards, tax, insurance, shops,
     choose-by-use) get a stronger grain: ink specks on the light ones, white specks on the dark ones.
   The grain is one small SVG tile (drawn once by the browser and repeated): no picture to download, nothing
   that moves, and it lies under the text, never over it. Left out for visitors who ask for more contrast. */
:root {
	--pt-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 .094 0 0 0 0 .29 .22 0 0 0 -.065'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
	--pt-grain-strong: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 .094 0 0 0 0 .29 .5 0 0 0 -.15'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
	--pt-grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .34 0 0 0 -.1'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
	--pt-glow-blue: radial-gradient(max(70vw, 340px) 540px at 0 0, rgba(0, 74, 235, .13), rgba(0, 74, 235, 0) 70%);
	--pt-glow-orange: radial-gradient(max(60vw, 300px) 460px at 100% 0, rgba(254, 147, 0, .14), rgba(254, 147, 0, 0) 70%);
}
html { background-color: #f6f8fd; background-image: var(--pt-grain), var(--pt-glow-blue), var(--pt-glow-orange); background-repeat: repeat, no-repeat, no-repeat; background-size: 200px 200px, auto, auto; }
.pt-hw { background-image: var(--pt-grain), radial-gradient(760px 420px at 100% 0, #fff2a2 0, rgba(255, 242, 162, 0) 70%), radial-gradient(900px 520px at 0 0, #cfe5ff 0, rgba(207, 229, 255, 0) 72%), linear-gradient(#e4eeff 0, #f0f5ff 640px, #f4f7fd 100%); background-repeat: repeat, repeat, repeat, no-repeat; background-size: 200px 200px, auto, auto, auto; }
.pt-ccw { background-image: var(--pt-grain), var(--pt-glow-blue), var(--pt-glow-orange); background-repeat: repeat, no-repeat, no-repeat; background-size: 200px 200px, auto, auto; }
.pt-ug-hero { background-image: var(--pt-grain-strong), linear-gradient(135deg, #eef3ff, #fff8ec); background-repeat: repeat, no-repeat; background-size: 200px 200px, auto; }
.pt-hero, .pt-af-mast, .pt-cath, .pt-cc-band, .ptx-band, .pt-ins-mast, .pt-vd-mast { isolation: isolate; }
.pt-hero::after, .pt-af-mast::after, .pt-cath::after, .pt-cc-band::after, .ptx-band::after, .pt-ins-mast::after, .pt-vd-mast::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--pt-grain-strong) 0 0 / 200px 200px; }
.pt-cath::after, .pt-cc-band::after, .ptx-band::after, .pt-ins-mast::after, .pt-vd-mast::after { background-image: var(--pt-grain-light); }
@media (prefers-contrast: more) {
	html, .pt-ccw { background-image: none; }
	.pt-hero::after, .pt-af-mast::after, .pt-cath::after, .pt-cc-band::after, .ptx-band::after, .pt-ins-mast::after, .pt-vd-mast::after { content: none; }
}

/* 18 Nov 2026, the owner, desktop: "อยากให้คำว่าเทียบขึ้นไปอยู่แถวเดียวกันกับ ผ่อน 0%". The compare tick had a strip
   of its own under the card's tags (38 px). The strip is gone: the tags row moves to the card's foot and keeps a
   place at its right end the size of the tick, so the tick (still pinned to the card's corner by the theme) sits
   on the tags' row. When the tags leave no room for it the place wraps under them, as before. Cards whose tags
   are hidden on desktop (the "new products" slider) keep the strip. */
@media (min-width: 1024px) {
	a.pt-pc[data-cmp-id] > .pt-pc-body { display: flex; flex-direction: column; flex: 1 1 auto; padding-bottom: 8px; }
	a.pt-pc[data-cmp-id] > .pt-pc-body > .pt-pc-tags { margin-top: auto; padding-top: 1px; align-items: center; }
	a.pt-pc[data-cmp-id] > .pt-pc-body > .pt-pc-tags::after { content: ""; flex: none; width: 66px; height: 26px; margin-left: auto; }
	.pt-new-list a.pt-pc[data-cmp-id] > .pt-pc-body { padding-bottom: 38px; }
}

/* 18 Nov 2026, the owner: a price-tier chart on every sub-category page, "ใส่เป็น รุ่นกับแบรนด์ให้เห็นไปเลยเอาตัวฮิตๆ
   แต่แยกราคาให้ชัดเจน สำหรับ version มือถือก็หาทางทำให้ compact อาจจะทำเป็นกราฟแต่ละ quardrant". The block is the
   site's own (src/builders/price-tiers.mjs): rows on a price axis on desktop, an axis strip over four quadrants
   on the phone. Tier colours: grey-blue, orange, blue, ink (text on each passes AA). */
.pt-ptier { --t: #cfd8e8; --tx: #00184a; margin: 0 0 24px; color: #00184a; }
.pt-ptier .t1 { --t: #cfd8e8; --tx: #00184a; }
.pt-ptier .t2 { --t: #fe9300; --tx: #00184a; }
.pt-ptier .t3 { --t: #004aeb; --tx: #fff; }
.pt-ptier .t4 { --t: #00184a; --tx: #fff; }
.pt-ptier-hd b { font-size: 15px; line-height: 1.3; font-weight: 800; }
.pt-ptier-hd small { display: block; font-size: 12px; line-height: 1.4; color: #52606d; }
.pt-ptier-hit { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 8px; align-items: center; min-height: 44px; color: inherit; text-decoration: none; }
.pt-ptier-hit img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #fff; }
.pt-ptier-hit span { display: grid; min-width: 0; font-size: 12.5px; line-height: 1.3; }
.pt-ptier-hit span b, .pt-ptier-hit span i { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-ptier-hit span b { font-weight: 800; }
.pt-ptier-hit span i { font-style: normal; color: #3b4f73; }
.pt-ptier-hit em { font-style: normal; font-size: 13.5px; font-weight: 800; color: #c2410c; font-variant-numeric: tabular-nums; }
.pt-ptier-hit:hover span i, .pt-ptier-all:hover { color: #004aeb; }
.pt-ptier-all { font-size: 13px; font-weight: 700; color: #004aeb; text-decoration: none; white-space: nowrap; }
.pt-ptier-hit:focus-visible, .pt-ptier-all:focus-visible { outline: 2px solid #004aeb; outline-offset: 2px; border-radius: 6px; }
@media (min-width: 1024px) {
	.pt-ptier-strip, .pt-ptier-range { display: none; }
	.pt-ptier-rows { border: 1px solid #e3e8f0; border-radius: 16px 16px 0 0; background: #fff; padding: 0 20px; }
	.pt-ptier-row, .pt-ptier-axis { display: grid; grid-template-columns: 128px minmax(0, 1fr) 96px; column-gap: 16px; }
	.pt-ptier-row { align-items: center; padding: 14px 0 12px; }
	.pt-ptier-row + .pt-ptier-row { border-top: 1px solid #e3e8f0; }
	.pt-ptier-hd { grid-column: 1; grid-row: 1 / span 2; }
	.pt-ptier-hd b { display: block; font-size: 16px; }
	.pt-ptier-plot { grid-column: 2; grid-row: 1; position: relative; height: 34px; background: repeating-linear-gradient(to right, #e3e8f0 0 1px, transparent 1px 25%); border-right: 1px solid #e3e8f0; }
	.pt-ptier-bar { position: absolute; top: 0; height: 34px; min-width: max-content; box-sizing: border-box; padding: 0 12px; display: grid; place-items: center; border-radius: 4px; background: var(--t); color: var(--tx); font-size: 14px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
	.pt-ptier-hits { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
	.pt-ptier-all { grid-column: 3; grid-row: 1 / span 2; justify-self: end; }
	.pt-ptier-axis { padding: 6px 20px 8px; border: 1px solid #e3e8f0; border-top: 0; border-radius: 0 0 16px 16px; background: #f7f9fc; }
	.pt-ptier-axis > div { grid-column: 2; display: flex; justify-content: space-between; font-size: 12px; color: #52606d; font-variant-numeric: tabular-nums; }
	.pt-ptier-axis span { width: 0; display: flex; justify-content: center; white-space: nowrap; }
	.pt-ptier-axis span:first-child { justify-content: flex-start; }
	.pt-ptier-axis span:last-child { justify-content: flex-end; }
}
@media (max-width: 1023px) {
	.pt-ptier { margin: 0 0 16px; }
	.pt-ptier-plot, .pt-ptier-axis { display: none; }
	.pt-ptier-strip { margin: 8px 0 10px; }
	.pt-ptier-strip > div { position: relative; height: 12px; border-radius: 6px; background: #eef2f8; overflow: hidden; }
	.pt-ptier-strip i { position: absolute; top: 0; bottom: 0; background: var(--t); border-radius: 3px; }
	.pt-ptier-strip p { display: flex; justify-content: space-between; margin: 3px 0 0; font-size: 11.5px; line-height: 1.3; color: #52606d; font-variant-numeric: tabular-nums; }
	.pt-ptier-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
	.pt-ptier-row { display: flex; flex-direction: column; min-width: 0; padding: 8px 9px 4px; border: 1px solid #e3e8f0; border-top: 5px solid var(--t); border-radius: 12px; background: #fff; }
	.pt-ptier-hd b { display: block; font-size: 13px; color: #3b4f73; }
	.pt-ptier-range { display: block; font-size: 15.5px; line-height: 1.3; font-weight: 800; font-variant-numeric: tabular-nums; }
	.pt-ptier-hd small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.pt-ptier-hits { margin-top: 6px; border-top: 1px solid #eef2f8; }
	.pt-ptier-hit { grid-template-columns: 34px minmax(0, 1fr); column-gap: 7px; padding: 5px 0; }
	.pt-ptier-hit img { width: 34px; height: 34px; }
	.pt-ptier-hit span { font-size: 12px; }
	.pt-ptier-hit:nth-child(n+3) { display: none; }
	.pt-ptier-all { display: flex; align-items: center; min-height: 44px; margin-top: auto; border-top: 1px solid #eef2f8; }
}

/* ── Credit cards page, desktop: the owner's pinned comments of 18 Nov 2026 (review page, 🖥 จอคอม) ── */
@media (min-width: 1024px) {
	/* #1 "ปรับ Design ให้ดียิ่งขึ้นได้ไหม อยากให้เห็นบัตรเครดิตใหญ่กว่านี้" and #5 "ขยับตรงนี้ [ใช้ต่างประเทศ] ไปไว้ในส่วนที่
	   ว่างกว่านี้ได้ไหม เพื่อให้ขนาดการ์ดสั้นลง": the card's picture is nearly half as wide again (96 → 140 px, with a soft
	   shadow), and the "ใช้ต่างประเทศ" chips leave the name column for the empty space under the fee / income
	   figures. The name block's pieces become cells of the row's own grid; the last row is flexible, so the
	   tall cells (picture, figures, buttons) never push the title, the line under it and the perks apart. */
	#pt-cc-results .pt-card { grid-template-columns: 24px 140px minmax(0, 1fr) 216px 114px; grid-template-rows: auto auto auto 1fr; gap: 0 14px; padding: 18px 10px 18px 4px; }
	#pt-cc-results .pt-card .pt-row-rk { grid-column: 1; grid-row: 1 / -1; font-size: 20px; font-weight: 800; color: #00184a; }
	#pt-cc-results .pt-card .pt-row-pic { grid-column: 2; grid-row: 1 / -1; gap: 9px; }
	#pt-cc-results .pt-card .pt-row-pic .pt-cc-art { width: 140px; border-radius: 10px; border-color: #dfe4ec; background: #fff; box-shadow: 0 6px 16px rgba(0, 24, 74, .14); }
	#pt-cc-results .pt-card .pt-card-name { display: contents; }
	#pt-cc-results .pt-card .pt-card-name > b { grid-column: 3; grid-row: 1; }
	#pt-cc-results .pt-card .pt-card-name > small { grid-column: 3; grid-row: 2; }
	#pt-cc-results .pt-card .pt-card-name > .pt-perk { grid-column: 3; grid-row: 3; }
	#pt-cc-results .pt-card .pt-spec { grid-column: 4; grid-row: 1 / -1; align-self: start; height: 82px; overflow: hidden; gap: 6px 8px; padding-left: 12px; }
	#pt-cc-results .pt-card .pt-spec dt, #pt-cc-results .pt-card .pt-spec dd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	#pt-cc-results .pt-card .pt-spec dt { font-size: 12px; }
	#pt-cc-results .pt-card .pt-card-name > .pt-abroad { grid-column: 4; grid-row: 1 / -1; align-self: start; margin: 82px 0 0; padding: 10px 0 0 12px; border-left: 1px solid #dfe4ec; }
	#pt-cc-results .pt-card .pt-foot { grid-column: 5; grid-row: 1 / -1; }

	/* #6 "ขยับลงมาจากด้านบนนิดนึง มันติดกันเกินไป": the "อยากได้แบบไหน" chips sat right under the total line */
	#pt-cx-in .pt-cx-pref { margin-top: 16px; }

	/* #7 "อยากให้ออกแบบตรงนี้ให้สวยกว่านี้ ตรงหัวตาราง": the calculator table's head was one dark block with an empty
	   corner. It is light now: a group line (blue for the six spending columns, orange for the two yearly ones),
	   each spending column's monthly amount in blue under its name, and the answer column (คุ้มสุทธิ/ปี) tinted. */
	#pt-cx-table { border-radius: 14px; }
	#pt-cx-table thead th { background: #f3f6fc; color: #00184a; border-bottom: 1px solid #dfe4ec; }
	#pt-cx-table thead th small { color: #52606d; }
	#pt-cx-table thead tr.pt-cx-grp th { padding: 10px 8px 7px; background: #fff; border-bottom: 0; font-size: 12px; font-weight: 700; color: #3b4f73; }
	#pt-cx-table thead tr.pt-cx-grp th + th { border-left: 0; }
	#pt-cx-table thead tr.pt-cx-grp th[colspan="6"] { color: #004aeb; box-shadow: inset 0 -3px 0 #004aeb; }
	#pt-cx-table thead tr.pt-cx-grp th[colspan="2"] { color: #8a4b00; box-shadow: inset 0 -3px 0 #fe9300; }
	#pt-cx-table thead tr:last-child th { font-size: 13px; }
	#pt-cx-table thead tr:last-child th:nth-child(n+2):nth-child(-n+7) small { color: #1d3f9e; font-weight: 600; }
	#pt-cx-table thead tr:last-child th:last-child { background: #fff4e0; }

	/* #9 "เวลากด 1 ล้าน 3 ล้าน คำพวกนี้โดนบังอยู่": the "คุณ 3 ล้าน" label slid under the first bank's highlighted
	   level, and the dashed line ran through the level names. The label has room of its own above the rows and
	   stays on top; the line passes behind the bars. */
	#pt-cc-wealth .pt-aum-body { padding-top: 34px; }
	#pt-cc-wealth .pt-aum-you { z-index: auto; }
	#pt-cc-wealth .pt-aum-you b { top: 7px; z-index: 5; }
	#pt-cc-wealth .pt-aum-bar { z-index: 1; }
	#pt-cc-wealth .pt-aum-bar.now { z-index: 3; }
}

/* ── Phone layout: the owner's pinned comments of 18 Nov 2026 (review page, 📱 มือถือ) ── */
@media (max-width: 1023px) {
	/* #2 product page, "มือถือรุ่นนี้เหมาะกับ": "ต้องการให้ Compact กว่านี้ เหลือพื้นที่ว่างมากเกินไป". Each use sat on a
	   line of its own with half the width empty. The heading and the uses now share lines, and the long
	   "ตรงสเปกแนะนำ" / "ผ่านขั้นต่ำ" read "แนะนำ" / "ขั้นต่ำ" (the full words stay in the page for screen readers). */
	.pt-sg.pt-sg-fits { padding: 10px 12px; }
	.pt-sg-fits .pt-sg-fit { gap: 6px; }
	.pt-sg-fits .pt-sg-fit ul { display: contents; }
	.pt-sg-fits .pt-sg-b { gap: 5px; padding: 4px 10px; }
	.pt-sg-fits .pt-sg-b em { font-size: 0; }
	.pt-sg-fits .pt-sg-b em::after { font-size: 11px; }
	.pt-sg-fits .pt-sg-b.rec em::after { content: "แนะนำ"; }
	.pt-sg-fits .pt-sg-b.min em::after { content: "ขั้นต่ำ"; }
	html:lang(en) .pt-sg-fits .pt-sg-b.rec em::after { content: "recommended"; }
	html:lang(en) .pt-sg-fits .pt-sg-b.min em::after { content: "minimum"; }
	.pt-sg-fits .pt-sg-note { margin-top: 6px; font-size: 11.5px; line-height: 1.4; }

	/* #13 article page, "อ่านต่อในหมวดเดียวกัน": "โชว์ปกเต็มๆดีๆ เอาอันดับเลขออก". The numbered dot took a column of
	   its own and the cover was cut to 16:10; the number is gone and the cover shows whole (16:9, as made). */
	.pt-ad-side .pt-ad-side-more li { display: block; }
	.pt-ad-side .pt-ad-side-more li::before { content: none; }
	.pt-ad-side .pt-ad-side-more img { aspect-ratio: 16 / 9; object-fit: contain; background: #f4f6fb; }

	/* #14 the menu drawer: "ทำให้มันใกล้กันกว่านี้ได้ไหม ตอนนี้ห่างกันเกินไป". Entries were 28 px apart; each is now
	   a 48 px row with 2 px between. */
	#mobile-menu-drawer nav { padding-top: 12px; padding-bottom: 12px; }
	#mobile-menu-drawer nav > a { min-height: 48px; margin-bottom: 2px; padding: 8px; }
}

/* 18 Nov 2026, the owner (article page): an eye with the number of views in the byline (and a share mark with
   the number of shares once they are counted). Wording patch in scripts/theme-patches.mjs; both layouts. */
.pt-ad-meta .pt-ad-stat { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.pt-ad-meta .pt-ad-stat svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pt-ad-meta .pt-ad-stat i { font-style: normal; }
