/* Shared by the pages below the landing page. index.html keeps its own inline
   styles — it is one self-contained file by design and is not touched here.
   Every value is lifted from index.html so the two levels look like one site. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Anuphan', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: rgba(var(--cyan-rgb),0.3); color: var(--fg-strong); }
a { text-decoration: none; color: var(--cyan); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 8px;
}

/* ---- nav (same as the landing page) ---- */
nav {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: 16px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: rgba(var(--bg-rgb),0.62);
  border-bottom: 1px solid rgba(var(--ink-rgb),0.06);
}
/* แบรนด์เป็นฝ่ายยอมหด ไม่ใช่ปุ่ม — เดิม .brand-name เป็น nowrap และไม่มีอะไรให้มันหด
   พอเพิ่มปุ่มสลับธีมเข้าแถบเดียวกัน หน้าที่ปุ่มกลับยาว ("Vibe Coding") ที่ 375px
   ชื่อแบรนด์ไหลไปทับปุ่มธีม · overflow วัดได้ 0 เพราะมันซ้อนกัน ไม่ได้ล้นจอ จึงไม่มีอะไรฟ้อง */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 44px;
  flex: 1 1 auto; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
nav .nav-right { flex: none; }
/* จอแคบมาก เหลือแต่โลโก้ — ชื่อที่ถูกตัดเหลือ "Artt…" ดูเหมือนของพัง มากกว่าไม่มีชื่อ */
@media (max-width: 400px) { .brand-name { display: none; } }
.logo { position: relative; width: 30px; height: 30px; flex: none;
        display: flex; align-items: center; justify-content: center; }
.logo .diamond { position: absolute; inset: 0; border-radius: 9px;
  background: var(--brand-grad); transform: rotate(45deg);
  box-shadow: 0 0 22px rgba(var(--cyan-rgb),0.55); }
.logo .dot { position: absolute; width: 9px; height: 9px; border-radius: 3px; background: var(--bg); }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: 0.02em; color: var(--fg-strong); white-space: nowrap; }
.back {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px;
  padding: 0 14px; border-radius: 10px; font-size: 14.5px; color: var(--fg-nav);
  border: 1px solid rgba(var(--ink-rgb),0.12); white-space: nowrap;
}
.back:hover { color: var(--fg-strong); border-color: rgba(var(--ink-rgb),0.28); }

/* ---- page frame ---- */
.wrap {
  max-width: 1200px; margin: 0 auto;
  padding: 40px max(20px, env(safe-area-inset-left)) 96px max(20px, env(safe-area-inset-right));
}
.wrap.reading { max-width: 760px; }
.sec-eyebrow { font-family: 'JetBrains Mono', monospace; font-size: 13px;
               letter-spacing: 0.08em; color: var(--cyan); }
h1 { margin: 0; font-size: clamp(30px,4.4vw,46px); font-weight: 600;
     letter-spacing: -0.02em; color: var(--fg-strong); line-height: 1.2; text-wrap: balance; }
.lede { margin: 0; max-width: 60ch; font-size: 17px; line-height: 1.7; color: var(--fg-mute); }
.page-head { display: flex; flex-direction: column; gap: 13px; margin-bottom: 40px; }

/* ---- cards (same anatomy as the landing page) ---- */
/* เพดาน 420px ไม่ใช่ 1fr — หมวดที่มีเรื่องเดียวจะได้ไม่ยืดเต็มแถว
   วัดแล้วการ์ดใบเดียวกว้าง 1160px ทำให้ข้อความซ้ายกับป้ายราคาห่างกัน 975px
   ซึ่งอ่านเป็นการ์ดที่ยังโหลดไม่เสร็จ มากกว่าการ์ดที่มีของอยู่ใบเดียว */
.card-grid { display: grid; gap: 18px; justify-content: start;
  grid-template-columns: repeat(auto-fit, minmax(290px, 420px)); }
.item-card {
  position: relative; display: flex; flex-direction: column; gap: 16px;
  /* ล่าง 34 ไม่ใช่ 26 — แถบล่างเป็นที่ของยอดคลิก (.item-clicks) ซึ่งมาทีหลัง
     เผื่อไว้ตั้งแต่แรกทุกใบ ใบที่ยังไม่มีใครกดจึงไม่เตี้ยกว่าเพื่อน และหน้า
     ไม่ขยับตอนตัวเลขมาถึง · วัดแล้วที่ 26 เหลือช่องว่างใต้ปุ่มแค่ 4px ซึ่ง
     อ่านเป็นบรรทัดที่สองของปุ่ม ไม่ใช่ป้ายมุมการ์ด */
  padding: 26px 26px 34px;
  border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, rgba(var(--ink-rgb),0.045), rgba(var(--ink-rgb),0.012));
  border: 1px solid rgba(var(--ink-rgb),0.08);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .35s, box-shadow .35s;
}
.item-card:hover { transform: translateY(-6px); border-color: rgba(var(--indigo-rgb),0.5);
  box-shadow: 0 24px 60px -24px rgba(var(--indigo-rgb),0.4); }
.item-icon { width: 52px; height: 52px; border-radius: 14px; display: flex;
  align-items: center; justify-content: center;
  background: rgba(var(--indigo-rgb),0.1); border: 1px solid rgba(var(--indigo-rgb),0.28); color: var(--indigo); }
.item-card h3 { margin: 0; font-size: 19px; font-weight: 600; color: var(--fg-strong); }
.item-card p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--fg-mute); }
.item-meta { margin-top: auto; display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 500; color: var(--indigo); }
/* Anuphan เป็นตัวสำรอง ไม่ใช่ตัวแทน — เบราว์เซอร์เลือกฟอนต์ราย "ตัวอักษร"
   ละตินกับตัวเลขยังได้ JetBrains Mono หน้าตาป้ายอังกฤษไม่เปลี่ยน
   ส่วนอักษรไทยที่ mono ไม่มี glyph จะตกมาที่ Anuphan ซึ่งวางสระและวรรณยุกต์ถูก
   ก่อนหน้านี้มันตกไปที่ monospace ของระบบ ที่วางสระผิดตำแหน่ง */
.pill { font-family: 'JetBrains Mono', 'Anuphan', monospace; font-size: 10.5px;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.pill-online { background: rgba(var(--green-rgb),0.12); color: var(--green); border: 1px solid rgba(var(--green-rgb),0.25); }
.pill-beta { background: rgba(var(--gold-rgb),0.12); color: var(--gold); border: 1px solid rgba(var(--gold-rgb),0.25); }
.pill-soon { background: rgba(var(--slate-rgb),0.12); color: var(--slate); border: 1px solid rgba(var(--slate-rgb),0.25); }
.title-row { display: flex; align-items: flex-start; gap: 10px; }
.title-row .pill { flex: none; margin-top: 3px; }

/* ---- price tag on every sub-card ----
   Deliberately NO font-family here: it inherits Anuphan from the body.
   .pill uses JetBrains Mono, which carries no Thai glyphs — putting "ฟรี"
   or "350 บาท" in a .pill makes the browser fall back per glyph and keep
   the mono letter-spacing, which looks broken. Prices are Thai, so they
   get their own class. */
.price { margin-left: auto; flex: none; font-size: 12.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
/* เดือนที่จัดทำ — มุมขวาบนของการ์ด ตรงข้ามไอคอน ไม่แย่งที่กับหัวเรื่อง
   ฟอนต์ต้องมี Anuphan สำรอง เพราะ JetBrains Mono ไม่มี glyph ไทย (ดูหมายเหตุท้ายไฟล์) */
.item-date { position: absolute; top: 15px; right: 17px; z-index: 1;
  font-family: 'JetBrains Mono', 'Anuphan', monospace; font-size: 10.5px;
  letter-spacing: 0.04em; color: var(--fg-dim); pointer-events: none; }
/* ยอดคนกด — มุมล่างซ้าย ทแยงกับป้ายเดือนที่มุมบนขวา และใช้หน้าตาชุดเดียวกัน
   เพราะมันเป็นของชนิดเดียวกัน: ข้อมูลประกอบ ไม่ใช่ส่วนหนึ่งของเนื้อการ์ด
   absolute และนั่งอยู่ในแถบ padding ล่าง 34px ที่ .item-card เผื่อไว้ให้แล้ว
   ป้ายจึงไม่ดันความสูงของการ์ด — เลขมาหลัง HTML เสมอ ถ้ามันกินที่ในสายการวาง
   หน้าจะขยับทุกครั้งที่โหลด */
.item-clicks { position: absolute; bottom: 11px; left: 26px; z-index: 1;
  font-family: 'JetBrains Mono', 'Anuphan', monospace; font-size: 10.5px;
  letter-spacing: 0.04em; color: var(--fg-dim); pointer-events: none; }
.price .was { opacity: 0.55; margin-right: 5px; font-weight: 500; }
.price-free { background: rgba(var(--green-rgb),0.12); color: var(--green); border: 1px solid rgba(var(--green-rgb),0.25); }
/* ป้ายเดียวในเว็บที่เป็นชิปทึบ ไม่ใช่พื้นจางเหมือนป้ายอื่น — สองเหตุผล:
   เหลืองทำเป็นพื้นจางบนพื้นสว่างไม่ได้ (จางพอจะเป็นพื้น = อ่านตัวไม่ออก · เข้มพอจะอ่านออก
   = ไม่เหลืองแล้ว) และของที่ต้องจ่ายเงินคือของที่ควรสะดุดตากว่าของฟรี
   วัดได้ 9.83 ฝั่งมืด · 8.46 ฝั่งสว่าง · ขอบ 1px ไว้เพื่อให้สูงเท่าป้าย .price-free พอดี */
.price-paid { background: var(--yellow); color: var(--on-yellow); border: 1px solid var(--yellow); }

/* A sub-card with nothing to open yet: no link, so no lift on hover. */
.item-card.soon { cursor: default; }
.item-card.soon:hover { transform: none; border-color: rgba(var(--ink-rgb),0.08); box-shadow: none; }
.item-card.soon .item-icon { background: rgba(var(--slate-rgb),0.08);
  border-color: rgba(var(--slate-rgb),0.22); color: var(--slate); }
.item-card.soon .item-meta { color: var(--fg-faint); }

/* ---- article ---- */
article { font-size: 16.5px; line-height: 1.85; color: var(--fg-3); }
article > * + * { margin-top: 18px; }
article h2 {
  margin: 52px 0 0; font-size: clamp(23px,2.8vw,29px); font-weight: 600;
  color: var(--fg-strong); letter-spacing: -0.01em; line-height: 1.3; scroll-margin-top: 80px;
}
article h3 { margin: 32px 0 0; font-size: 19px; font-weight: 600; color: var(--fg-strong); }
article p { margin: 0; }
article b, article strong { color: var(--fg); font-weight: 600; }
article ul { margin: 0; padding-left: 22px; display: grid; gap: 7px; }
article li::marker { color: var(--cyan); }

.part {
  display: flex; align-items: baseline; gap: 12px;
  margin: 64px 0 0; padding-top: 26px; border-top: 1px solid rgba(var(--ink-rgb),0.09);
}
.part .no { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500; }
.part .nm { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-mute); }

.panel { background: rgba(var(--ink-rgb),0.028); border: 1px solid rgba(var(--ink-rgb),0.08);
  border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 9px; }
.panel h4 { margin: 0; font-size: 16px; font-weight: 600; color: var(--fg-strong); }
.panel p { font-size: 15.5px; color: var(--fg-mute); }

.scroll { overflow-x: auto; border: 1px solid rgba(var(--ink-rgb),0.08); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; min-width: 460px; }
th, td { text-align: left; padding: 13px 16px; font-size: 15px; vertical-align: top;
         border-bottom: 1px solid rgba(var(--ink-rgb),0.07); }
th { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.08em;
     text-transform: uppercase; color: var(--fg-mute); background: rgba(var(--ink-rgb),0.03); }
tbody tr:last-child td { border-bottom: none; }

/* Prompt blocks: on paper these were "copy this by hand"; on screen they can
   actually copy, so the label became a button. */
.prompt { border: 1px solid rgba(var(--ink-rgb),0.1); border-left: 3px solid var(--cyan);
  border-radius: 0 14px 14px 0; background: rgba(var(--cyan-rgb),0.05);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.prompt .txt { font-size: 16px; line-height: 1.85; color: var(--fg-2); }
.prompt .slot { color: var(--cyan); font-weight: 600; }
.copy { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 15px; border-radius: 10px; cursor: pointer;
  font-family: 'Anuphan', sans-serif; font-size: 14.5px; font-weight: 500;
  background: rgba(var(--cyan-rgb),0.12); color: var(--cyan);
  border: 1px solid rgba(var(--cyan-rgb),0.32); transition: background .2s; }
.copy:hover { background: rgba(var(--cyan-rgb),0.2); }
.copy[data-done="1"] { background: rgba(var(--green-rgb),0.14); color: var(--green);
  border-color: rgba(var(--green-rgb),0.3); }

.printbtn { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  min-height: 44px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  font-family: 'Anuphan', sans-serif; font-size: 14.5px; font-weight: 500;
  background: rgba(var(--ink-rgb),0.05); color: var(--fg-nav);
  border: 1px solid rgba(var(--ink-rgb),0.14); transition: background .2s, color .2s; }
.printbtn:hover { background: rgba(var(--ink-rgb),0.1); color: var(--fg-strong); }

.check { list-style: none; padding: 0; display: grid; gap: 10px; }
.check li { display: flex; gap: 12px; align-items: flex-start; }
.check li::before { content: ""; flex: none; width: 15px; height: 15px; margin-top: 7px;
  border: 1.5px solid var(--fg-faint); border-radius: 4px; }

footer { border-top: 1px solid rgba(var(--ink-rgb),0.07);
  padding: 26px max(20px, env(safe-area-inset-left))
           max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-right));
  display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between;
  font-size: 13.5px; color: var(--fg-dim); max-width: 1200px; margin: 0 auto; }

/* ---- วิดีโอ YouTube แบบกดแล้วค่อยโหลด (ดู yt.js) ----
   เริ่มต้นเป็นข้อความสำรอง "คลิปกำลังตามมา" · พอใส่ ID สคริปต์แทนด้วยกรอบ 16:9
   พื้นกรอบใช้ --scrim ซึ่งดำเท่ากันทั้งสองธีม — ถ้าตามธีมสว่าง ปุ่มเล่นสีขาว
   จะหายไปบนพื้นขาว และวิดีโอก็มีขอบดำเป็นธรรมชาติอยู่แล้ว */
.yt { margin: 0 0 34px; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(var(--ink-rgb),0.08); }
.yt-soon { margin: 0; display: flex; align-items: center; gap: 10px; padding: 15px 18px;
  font-size: 15px; line-height: 1.6; color: var(--fg-mute); background: rgba(var(--ink-rgb),0.028); }
.yt-soon svg { flex: none; color: var(--red); }
.yt-frame { position: relative; aspect-ratio: 16 / 9; background: var(--scrim); }
.yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-play { position: absolute; inset: 0; width: 100%; height: 100%; display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 20px; border: 0; cursor: pointer; font: inherit; font-size: 15.5px;
  background: var(--scrim); color: var(--on-solid); }
.yt-btn { width: 68px; height: 48px; border-radius: 14px; display: flex; align-items: center;
  justify-content: center; background: var(--red-solid); transition: transform .2s; }
.yt-play:hover .yt-btn { transform: scale(1.06); }
.yt-label { max-width: 90%; text-align: center; line-height: 1.5; }

/* ---- ป๊อปอัปเข้าสู่ระบบตอนกดการ์ดย่อย (สร้างใน cards.js) ----
   <dialog> กับ showModal() ของเบราว์เซอร์เอง ได้มาทั้งชุดโดยไม่ต้องเขียน: โฟกัสถูกขัง
   ในกล่อง Esc ปิดได้ ข้างหลังกดไม่ได้ และโปรแกรมอ่านจอประกาศว่าเป็นกล่องโต้ตอบ
   ::backdrop ของเบราว์เซอร์รุ่นเก่าไม่สืบทอดโทเคน — พื้นหลังจะใสแต่ยังเบลอ ใช้งานได้เท่าเดิม */
dialog.card-gate { width: min(400px, calc(100% - 40px)); max-width: none; margin: auto; padding: 0;
  border-radius: 18px; border: 1px solid rgba(var(--ink-rgb),0.12);
  background: var(--bg); color: var(--fg); font-family: 'Anuphan', sans-serif;
  box-shadow: 0 30px 80px -24px rgba(var(--indigo-rgb),0.45);
  animation: card-gate-in .24s cubic-bezier(.2,.7,.2,1); }
dialog.card-gate::backdrop { background: rgba(var(--bg-rgb),0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.card-gate-box { display: flex; flex-direction: column; gap: 12px; padding: 28px 24px 18px; }
.card-gate-title { margin: 0; font-size: 21px; font-weight: 600; line-height: 1.35;
  color: var(--fg-strong); text-wrap: balance; }
/* ชื่อการ์ดที่เพิ่งกด — ให้รู้ว่าป๊อปอัปพูดถึงอะไร ไม่ใช่ป้ายขวางลอยๆ ที่โผล่มาเฉยๆ */
.card-gate-card { margin: 0; padding: 10px 13px; border-radius: 10px; font-size: 14.5px;
  line-height: 1.5; font-weight: 500; color: var(--fg-2); text-wrap: pretty;
  background: rgba(var(--indigo-rgb),0.08); border: 1px solid rgba(var(--indigo-rgb),0.22); }
.card-gate-note { margin: 0 0 6px; font-size: 14.5px; line-height: 1.7; color: var(--fg-mute); }
.card-gate-nw { white-space: nowrap; }
.card-gate-google { display: flex; align-items: center; justify-content: center; gap: 11px;
  min-height: 52px; border-radius: 12px; font-size: 15.5px; font-weight: 600; color: var(--fg);
  background: rgba(var(--ink-rgb),0.05); border: 1px solid rgba(var(--ink-rgb),0.14);
  transition: border-color .2s, background .2s; }
.card-gate-google:hover { background: rgba(var(--ink-rgb),0.09); border-color: rgba(var(--indigo-rgb),0.5); }
.card-gate-later { min-height: 44px; border: 0; border-radius: 10px; background: none;
  cursor: pointer; font: inherit; font-size: 14.5px; color: var(--fg-mute); }
.card-gate-later:hover { color: var(--fg-strong); }
@keyframes card-gate-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { dialog.card-gate { animation: none; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- print ----------------------------------------------------------------
   The site is dark on screen. Printing that as-is floods the page with ink and
   comes out unreadable, so paper gets its own light treatment: the chrome and
   the buttons go away, panels lose their fills, and everything is set in black
   on white at a size that reads on paper. Both content pages get this, whether
   or not they show a print button.                                          */
@media print {
  @page { size: A4; margin: 16mm 15mm; }

  html, body { background: #fff !important; color: #1a1a1a !important; }
  nav, footer, .back, .copy, .no-print { display: none !important; }

  .wrap, .wrap.reading { max-width: none; padding: 0; }
  a { color: #1a1a1a; text-decoration: underline; }

  h1 { font-size: 24pt; color: #000; }
  .lede { color: #444; font-size: 12pt; }
  .sec-eyebrow { color: #555; }
  article { font-size: 11.5pt; line-height: 1.65; color: #1a1a1a; }
  article h2 { color: #000; font-size: 16pt; margin-top: 22pt; break-after: avoid; }
  article h3 { color: #000; font-size: 13pt; break-after: avoid; }
  b, strong, article b, article strong { color: #000 !important; }
  article li::marker { color: #555; }

  .part { border-top: 1pt solid #999; margin-top: 24pt; break-after: avoid; }
  .part .no, .part .nm { color: #555 !important; }

  /* Fills become hairlines — the shape survives, the ink does not. */
  .panel, .prompt, .item-card, .scroll {
    background: #fff !important; border: 0.6pt solid #bbb !important;
    box-shadow: none !important; break-inside: avoid;
  }
  .panel h4, .item-card h3 { color: #000 !important; }
  .panel p, .item-card p { color: #333 !important; }
  .prompt { border-left: 2.5pt solid #555 !important; border-radius: 0 !important; }
  .prompt .txt { color: #000 !important; font-size: 11pt; }
  .prompt .slot { color: #000 !important; text-decoration: underline; }

  th { background: #f0f0f0 !important; color: #333 !important; }
  th, td { border-bottom: 0.6pt solid #ccc !important; color: #1a1a1a; }
  table { break-inside: auto; }
  tr { break-inside: avoid; }

  .check li::before { border-color: #666 !important; }
  .pill { border: 0.6pt solid #999 !important; background: #fff !important; color: #333 !important; }
  .item-date { color: #666 !important; }
  /* ยอดคลิกเป็นของที่สดตลอดเวลา พอพิมพ์ออกมาก็กลายเป็นตัวเลขที่ผิดทันที */
  .item-clicks { display: none !important; }
  .price { border: 0.6pt solid #999 !important; background: #fff !important; color: #000 !important; }
}
