/* ==========================================================================================
   PREVIEW UI ONLY (audit rounds 6-8): members paywall, "private library invitation".
   No signup or payment is wired. Palette follows the home hero variant B:
   near-black #0E0507, deep wine #2A0910, crimson light #C8102E, ivory #F3EADF,
   hairlines in warm parchment rgba(232,200,160,.x). Latin display: Cinzel (site wordmark
   font); numerals and Arabic ornament: Amiri; Thai: IBM Plex Sans Thai / Sarabun.
   Pricing-card pattern (two plans, recommended plan raised with a hairline gradient border)
   re-implemented from common premium pricing layouts showcased on 21st.dev.
   ========================================================================================== */
.pw-teaser { position: relative; margin: 0 0 8px; }
.pw-teaser-eyebrow { margin: 0 0 10px; font: 500 12px/1.4 'IBM Plex Sans Thai', system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #6b645e; }
.pw-teaser-title { margin: 0 0 10px; font: 700 clamp(24px, 4.6vw, 34px)/1.3 'IBM Plex Sans Thai', system-ui, sans-serif; color: #141210; letter-spacing: -.005em; }
.pw-teaser-meta { margin: 0 0 18px; font: 400 15px/1.6 'Sarabun', system-ui, sans-serif; color: #57534e; }
.pw-fade { position: relative; max-height: 9.5em; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .55) 45%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .55) 45%, transparent 100%); }
.pw-fade p { margin: 0 0 1em; font: 400 18px/1.9 'Sarabun', system-ui, sans-serif; color: #2b2623; }
.pw-sentinel { height: 1px; }

/* ---- the panel --------------------------------------------------------------------------- */
.pw {
  --pw-ivory: #f3eadf; --pw-ivory-2: rgba(243, 234, 223, .74); --pw-ivory-3: rgba(243, 234, 223, .56);
  --pw-gold: #e3c7a0; --pw-hair: rgba(232, 200, 160, .18); --pw-hair-2: rgba(232, 200, 160, .34);
  --pw-crimson: #c8102e; --pw-base: #0e0507; --pw-wine: #2a0910;
  position: relative; isolation: isolate; overflow: hidden;
  margin: 12px 0 0; padding: clamp(30px, 4.6vw, 52px) clamp(20px, 4.4vw, 52px) clamp(24px, 3.6vw, 40px);
  border-radius: 22px; color: var(--pw-ivory); text-align: left;
  background:
    radial-gradient(70% 55% at 88% -8%, rgba(200, 16, 46, .30) 0%, rgba(200, 16, 46, 0) 60%),
    radial-gradient(60% 50% at 6% 108%, rgba(158, 27, 47, .22) 0%, rgba(158, 27, 47, 0) 62%),
    radial-gradient(120% 90% at 50% 0%, var(--pw-wine) 0%, #160609 45%, var(--pw-base) 100%);
  box-shadow: 0 0 0 1px var(--pw-hair), 0 40px 90px -40px rgba(14, 5, 7, .75), 0 18px 40px -24px rgba(42, 9, 16, .6);
  font-family: 'Sarabun', system-ui, sans-serif;
}
/* fine inner frame, like a printed invitation */
.pw::before { content: ''; position: absolute; inset: 8px; border-radius: 16px; border: 1px solid rgba(232, 200, 160, .10); pointer-events: none; z-index: -1; }
/* soft grain */
.pw::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

.pw-head { text-align: center; margin: 0 auto clamp(26px, 3.4vw, 38px); max-width: 36em; }
.pw-ornament { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 14px; }
.pw-ornament::before, .pw-ornament::after { content: ''; width: clamp(34px, 7vw, 72px); height: 1px; background: linear-gradient(90deg, rgba(232, 200, 160, 0), var(--pw-hair-2)); }
.pw-ornament::after { transform: scaleX(-1); }
.pw-ornament span { font: 400 24px/1.4 'Amiri', serif; color: var(--pw-gold); letter-spacing: 0; }
.pw-eyebrow { margin: 0 0 16px; font: 600 11.5px/1.6 'Cinzel', 'Inter', serif; letter-spacing: .34em; color: var(--pw-gold); text-transform: uppercase; }
.pw-title { margin: 0 0 12px; font: 600 clamp(26px, 4vw, 38px)/1.3 'IBM Plex Sans Thai', system-ui, sans-serif; letter-spacing: -.01em; color: var(--pw-ivory); }
.pw-title .pw-shine {
  background-image: linear-gradient(100deg, #e9d9c6 0%, #f8ece0 30%, #fff7ee 44%, #ffffff 50%, #fff7ee 56%, #f8ece0 70%, #e9d9c6 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--pw-ivory);
  animation: pw-shine 7s ease-in-out infinite; }
@keyframes pw-shine { 0% { background-position: 120% 0; } 55%, 100% { background-position: -20% 0; } }
.pw-sub { margin: 0 auto; max-width: 31em; font: 300 16.5px/1.8 'Sarabun', system-ui, sans-serif; color: var(--pw-ivory-2); }

.pw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 2vw, 22px); align-items: stretch; }
.pw-card { position: relative; display: flex; flex-direction: column; gap: 0; padding: clamp(22px, 2.6vw, 30px); border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015)); border: 1px solid rgba(243, 234, 223, .13); }
/* recommended plan: hairline gradient border + faint crimson glow */
.pw-card.is-rec { border-color: transparent;
  background:
    linear-gradient(180deg, rgba(58, 14, 22, .92), rgba(22, 7, 10, .96)) padding-box,
    linear-gradient(150deg, rgba(232, 200, 160, .85), rgba(200, 16, 46, .55) 45%, rgba(232, 200, 160, .25)) border-box;
  box-shadow: 0 24px 60px -30px rgba(200, 16, 46, .55); }
.pw-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 4px 13px; border-radius: 999px; background: #1a080c; border: 1px solid var(--pw-hair-2);
  font: 500 11.5px/1.5 'IBM Plex Sans Thai', system-ui, sans-serif; letter-spacing: .08em; color: var(--pw-gold); }
.pw-badge i { width: 5px; height: 5px; transform: rotate(45deg); background: var(--pw-gold); }
.pw-plan { margin: 4px 0 2px; font: 600 21px/1.3 'Cinzel', 'Inter', serif; letter-spacing: .06em; color: var(--pw-ivory); }
.pw-plan-note { margin: 0 0 16px; font: 400 13.5px/1.6 'Sarabun', system-ui, sans-serif; color: var(--pw-ivory-3); }
.pw-price { display: flex; align-items: baseline; gap: 6px; margin: 0 0 6px; }
.pw-price b { font: 700 48px/1 'Amiri', serif; letter-spacing: 0; color: var(--pw-ivory); font-feature-settings: 'lnum' 1; }
.pw-price span { font: 400 14px/1 'IBM Plex Sans Thai', system-ui, sans-serif; color: var(--pw-ivory-3); }
.pw-beta-only { margin: 4px 0 0; font: 400 12.5px/1.5 'IBM Plex Sans Thai', system-ui, sans-serif; letter-spacing: .06em; color: var(--pw-gold); }
.pw-lead { margin: 10px 0 0; padding: 14px 0 0; border-top: 1px solid var(--pw-hair); font: 600 16px/1.55 'IBM Plex Sans Thai', system-ui, sans-serif; color: var(--pw-ivory); }
.pw-proposal { display: inline-block; margin: 8px 0 0; padding: 2px 9px; border-radius: 999px; border: 1px dashed rgba(232, 200, 160, .45);
  font: 500 11px/1.6 'IBM Plex Sans Thai', system-ui, sans-serif; letter-spacing: .04em; color: var(--pw-gold); align-self: flex-start; }
.pw-list { list-style: none; margin: 14px 0 22px; padding: 0; display: grid; gap: 10px; }
.pw-list li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; font: 400 14.5px/1.6 'Sarabun', system-ui, sans-serif; color: var(--pw-ivory-2); }
.pw-list svg { width: 15px; height: 15px; margin-top: 4px; color: var(--pw-gold); }
.pw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; box-sizing: border-box;
  margin-top: auto; padding: 0 20px; border-radius: 999px; cursor: pointer; text-decoration: none; border: 1px solid transparent;
  font: 600 15.5px/1 'IBM Plex Sans Thai', system-ui, sans-serif; letter-spacing: .02em;
  transition: background .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
.pw-btn svg { width: 16px; height: 16px; transition: transform .25s ease; }
.pw-btn.is-primary { background: linear-gradient(180deg, #fbf4ea, #eadbc6); color: #1a080c; box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 10px 26px -12px rgba(243, 234, 223, .5); }
.pw-btn.is-primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 16px 34px -14px rgba(243, 234, 223, .6); }
.pw-btn.is-primary:hover svg, .pw-btn.is-outline:hover svg { transform: translateX(3px); }
.pw-btn.is-outline { background: transparent; color: var(--pw-ivory); border-color: rgba(243, 234, 223, .42); }
.pw-btn.is-outline:hover { border-color: var(--pw-ivory); background: rgba(243, 234, 223, .06); }
.pw-btn:focus-visible, .pw-link:focus-visible, .pw-close:focus-visible, .pw-free-toggle:focus-visible { outline: 2px solid var(--pw-gold); outline-offset: 3px; }

.pw-rule { height: 1px; margin: clamp(24px, 3vw, 32px) auto 18px; max-width: 520px; background: linear-gradient(90deg, rgba(232, 200, 160, 0), var(--pw-hair-2), rgba(232, 200, 160, 0)); }
.pw-free { text-align: center; }
.pw-free-toggle { background: none; border: 0; padding: 6px 4px; min-height: 44px; cursor: pointer; color: var(--pw-ivory-2);
  font: 400 15px/1.6 'Sarabun', system-ui, sans-serif; text-decoration: underline; text-decoration-color: rgba(232, 200, 160, .45); text-underline-offset: 5px; }
.pw-free-toggle:hover { color: var(--pw-ivory); text-decoration-color: var(--pw-gold); }
.pw-free-form { display: flex; gap: 8px; justify-content: center; max-width: 460px; margin: 10px auto 0; }
.pw-free-form[hidden] { display: none; }
.pw-free-form input { flex: 1; min-width: 0; min-height: 46px; box-sizing: border-box; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgba(243, 234, 223, .28); background: rgba(255, 255, 255, .04); color: var(--pw-ivory); font: 400 15.5px/1 'Sarabun', system-ui, sans-serif; }
.pw-free-form input::placeholder { color: rgba(243, 234, 223, .45); }
.pw-free-form input:focus { outline: none; border-color: var(--pw-gold); box-shadow: 0 0 0 3px rgba(232, 200, 160, .16); }
.pw-free-form .pw-btn { width: auto; min-height: 46px; margin: 0; padding: 0 18px; }
.pw-status { min-height: 1.2em; margin: 8px 0 0; text-align: center; font: 400 13px/1.5 'Sarabun', system-ui, sans-serif; color: var(--pw-gold); }
.pw-foot { margin: 6px 0 0; text-align: center; font: 400 14.5px/1.6 'Sarabun', system-ui, sans-serif; color: var(--pw-ivory-3); }
.pw-link { color: var(--pw-ivory); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(232, 200, 160, .55); text-underline-offset: 4px; }
.pw-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border: 1px solid transparent; border-radius: 50%; background: transparent;
  color: var(--pw-ivory-2); cursor: pointer; display: none; z-index: 2; }
.pw-close:hover { border-color: var(--pw-hair-2); color: var(--pw-ivory); }
.pw-close svg { width: 18px; height: 18px; }
.pw-handle { display: none; }

/* ---- sheet mode: slides up once the reader reaches the members-only part ------------------ */
.pw-scrim { position: fixed; inset: 0 0 var(--ifp-dock-space, 0px) 0; z-index: 2147482990; pointer-events: none; opacity: 0; transition: opacity .6s ease;
  background: linear-gradient(180deg, rgba(14, 5, 7, 0) 0%, rgba(14, 5, 7, .38) 40%, rgba(14, 5, 7, .78) 100%); }
html.pw-open .pw-scrim { opacity: 1; }
.pw.is-sheet { position: fixed; z-index: 2147483000; left: 50%; bottom: calc(18px + var(--ifp-dock-space, 0px)); width: min(1040px, calc(100% - 36px));
  max-height: calc(100vh - 80px); max-height: calc(100svh - 80px - var(--ifp-dock-space, 0px)); overflow: auto; overscroll-behavior: contain; margin: 0;
  transform: translate(-50%, 0); animation: pw-up .7s cubic-bezier(.16, 1, .3, 1) both; scrollbar-width: thin; scrollbar-color: rgba(232, 200, 160, .3) transparent; }
.pw.is-sheet .pw-close { display: grid; place-items: center; }
/* desktop sheet: a little more compact so the whole invitation fits a laptop screen */
@media (min-width: 761px) {
  .pw.is-sheet { padding-top: 30px; padding-bottom: 26px; }
  .pw.is-sheet .pw-head { margin-bottom: 26px; }
  .pw.is-sheet .pw-ornament { margin-bottom: 8px; }
  .pw.is-sheet .pw-eyebrow { margin-bottom: 10px; }
  .pw.is-sheet .pw-list { margin: 12px 0 18px; }
  .pw.is-sheet .pw-rule { margin: 22px auto 10px; }
}
@keyframes pw-up { from { transform: translate(-50%, 56px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

@media (max-width: 760px) {
  .pw-grid { grid-template-columns: 1fr; gap: 22px; }
  .pw-card.is-rec { order: -1; }
  .pw { padding: 34px 18px 22px; border-radius: 20px; }
  .pw-title { font-size: 25px; }
  .pw-sub { font-size: 15.5px; }
  .pw-price b { font-size: 42px; }
  .pw-free-form { flex-direction: column; }
  .pw-free-form .pw-btn { width: 100%; }
  .pw.is-sheet { left: 0; right: 0; bottom: var(--ifp-dock-space, 0px); width: auto; transform: none; border-radius: 24px 24px 0 0;
    padding-top: 30px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); max-height: 88svh; animation-name: pw-up-m; }
  .pw.is-sheet .pw-handle { display: block; width: 42px; height: 4px; margin: -14px auto 18px; border-radius: 4px; background: rgba(243, 234, 223, .28); }
  @keyframes pw-up-m { from { transform: translateY(100%); } to { transform: translateY(0); } }
}
@media (prefers-reduced-motion: reduce) {
  .pw.is-sheet { animation: none; } .pw-scrim { transition: none; }
  .pw-title .pw-shine { animation: none; background-position: 50% 0; }
  .pw-btn, .pw-btn svg { transition: none; }
}

/* ---- demo meter for a signed-in free account (dark slim bar) ------------------------------ */
.pw-meter { display: flex; align-items: center; gap: 14px; margin: 0 0 24px; padding: 10px 10px 10px 18px; border-radius: 999px;
  background: radial-gradient(80% 140% at 100% 0%, rgba(200, 16, 46, .28), rgba(200, 16, 46, 0) 60%), linear-gradient(90deg, #160609, #0e0507);
  box-shadow: 0 0 0 1px rgba(232, 200, 160, .16), 0 14px 30px -18px rgba(14, 5, 7, .7); color: #f3eadf; font-family: 'Sarabun', system-ui, sans-serif; }
.pw-meter-dots { display: inline-flex; gap: 6px; flex: none; }
.pw-meter-dots i { width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid #e3c7a0; box-sizing: border-box; }
.pw-meter-dots i.is-used { background: #e3c7a0; }
.pw-meter-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pw-meter-text b { font: 500 14.5px/1.45 'IBM Plex Sans Thai', system-ui, sans-serif; color: #f3eadf; }
.pw-meter-text span { font: 400 12px/1.4 'Sarabun', system-ui, sans-serif; color: rgba(243, 234, 223, .62); letter-spacing: .02em; }
.pw-meter-cta { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: linear-gradient(180deg, #fbf4ea, #eadbc6); color: #1a080c !important; text-decoration: none; font: 600 13.5px/1 'IBM Plex Sans Thai', system-ui, sans-serif; }
.pw-meter-cta:focus-visible { outline: 2px solid #e3c7a0; outline-offset: 3px; }
@media (max-width: 480px) { .pw-meter { gap: 12px; padding: 8px 8px 8px 16px; } .pw-meter-dots { gap: 4px; } .pw-meter-dots i { width: 7px; height: 7px; } .pw-meter-text b { font-size: 14px; white-space: nowrap; } .pw-meter-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .pw-meter-cta { padding: 0 14px; } }

.pw-fade-live { position: relative; max-height: 16em; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 100%); }
/* free sample badge (chapter 1 of each series) */
.tq-row-sample, .tq-sample-badge { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; margin-top: 6px; padding: 2px 10px 2px 8px; border-radius: 999px;
  background: #1a1a1a; color: #fff; font: 500 11px/1.7 'IBM Plex Sans Thai', system-ui, sans-serif; letter-spacing: .04em; }
.tq-row-sample svg, .tq-sample-badge svg { width: 11px; height: 11px; }
.tq-sample-badge { margin: 0 0 12px; }
html.dark-mode .tq-row-sample, html.dark-mode .tq-sample-badge { background: #f5f1ea; color: #141210; }

/* feature flag (round 9): everything preview-only is hidden unless js/ifp-flags.js turned the
   paywall preview on (html.pw-preview-on). Flag OFF = live-site behaviour and labels. */
html:not(.pw-preview-on) [data-pw-preview], html:not(.pw-preview-on) .pw-label-on { display: none !important; }
html.pw-preview-on .pw-label-off { display: none !important; }
