/* DramaSwoon — plum screen frame around a calm reading column (copied from LakornFin) */
:root {
  --screen: #2a0f2e;
  --screen-deep: #1a0820;
  --screen-line: #4d2357;
  --screen-ink: #fbe9f2;
  --screen-dim: #d9a8c4;
  --outline: #0d0310;
  --wipe: #ff7aa2;
  --paper: #f8f4ec;
  --paper-2: #efe8db;
  --ink: #2a1630;
  --ink-2: #5e4a63;
  --rule: #e3dac9;
  --link: #9b2a5a;
  --link-hover: #2a0f2e;
  --display: 'Kanit', 'Sarabun', system-ui, sans-serif;
  --body: 'Sarabun', system-ui, sans-serif;
  --column: 40rem;
  --wide: 68rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  /* subtitle outline: real stroke under the fill + a faint outer ring and drop */
  --sub-stroke: 0.14em;
  --sub-shadow: 0 0 1px var(--screen-line), 0 5px 14px rgb(20 4 18 / 0.6);
}

* , *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--screen-line) var(--paper-2); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.8 var(--body);
  text-rendering: optimizeLegibility;
}
::selection { background: var(--wipe); color: var(--screen-deep); }
a { color: var(--link); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--wipe); outline-offset: 3px; border-radius: 4px; }
img, svg { max-width: 100%; height: auto; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--wipe); color: var(--screen-deep); padding: 0.5rem 1rem; }

/* ---------- the screen (frame) ---------- */
.screen {
  background:
    radial-gradient(120% 90% at 50% 0%, #17227060 0%, transparent 60%),
    var(--screen);
  color: var(--screen-ink);
}
.screen a { color: var(--screen-ink); }
.bar {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.75rem var(--gutter) 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo {
  font: 800 1.6rem/1 var(--display);
  color: #fff;
  text-decoration: none;
  -webkit-text-stroke: var(--sub-stroke) var(--outline);
  paint-order: stroke fill;
  text-shadow: var(--sub-shadow);
  letter-spacing: 0;
  padding: 0.2rem 0;
}
.logo:hover { color: #fff; text-decoration: none; }
.logo small {
  display: block;
  font: 600 0.72rem/1.2 var(--display);
  color: var(--screen-dim);
  -webkit-text-stroke: 0;
  text-shadow: none;
  letter-spacing: 0.08em;
  margin-top: 0.2rem;
}
.tabs {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  gap: 1.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--screen-line);
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.tabs::after { content: ""; flex: none; width: 2rem; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none;
  font: 600 0.95rem/1 var(--display);
  color: var(--screen-dim);
  text-decoration: none;
  padding: 0.95rem 0 0.8rem;
  border-bottom: 3px solid transparent;
}
.tabs a:hover { color: #fff; }
.tabs a[aria-current="page"] { color: var(--wipe); border-bottom-color: var(--wipe); }

.screen-head {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.4rem var(--gutter) 2rem;
}
.crumbs { font: 400 0.85rem/1.4 var(--body); color: var(--screen-dim); margin: 0 0 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--screen-dim); }
.crumbs span[aria-hidden] { margin: 0 0.4rem; }

/* subtitle titles: white fill, dark outline, one karaoke wipe */
.sub {
  position: relative;
  margin: 0;
  max-width: 22ch;
  font: 800 clamp(1.75rem, 1.1rem + 3.4vw, 3.1rem)/1.32 var(--display);
  color: #fff;
  -webkit-text-stroke: var(--sub-stroke) var(--outline);
  paint-order: stroke fill;
  text-shadow: var(--sub-shadow);
  text-wrap: balance;
}
.sub a, .sub a:hover { color: inherit; text-decoration: none; }
.sub::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--wipe);
  -webkit-text-stroke: var(--sub-stroke) var(--outline);
  paint-order: stroke fill;
  /* the wipe settles on the first line only: the "current lyric" */
  clip-path: inset(0 100% calc(100% - 1.32em) 0);
  animation: wipe 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.25s forwards;
  pointer-events: none;
}
@keyframes wipe { to { clip-path: inset(0 0 calc(100% - 1.32em) 0); } }
@media (prefers-reduced-motion: reduce) {
  .sub::after { animation: none; clip-path: inset(0 0 calc(100% - 1.32em) 0); }
}
.screen-dek {
  margin: 1rem 0 0;
  max-width: 38rem;
  color: var(--screen-dim);
  font-size: 1rem;
  line-height: 1.7;
}

/* part markers: which part of the summary you are on */
.parts { display: flex; align-items: center; gap: 0.6rem; margin: 1.2rem 0 0; font: 600 0.9rem/1 var(--display); color: var(--screen-dim); }
.parts ol { display: flex; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.parts li a, .parts li span {
  display: grid; place-items: center;
  min-width: 2.25rem; height: 2.25rem; padding: 0 0.5rem;
  border: 1px solid var(--screen-line); border-radius: 6px;
  color: var(--screen-ink); text-decoration: none;
}
.parts li [aria-current="page"] { background: var(--wipe); border-color: var(--wipe); color: var(--screen-deep); }

/* last-read flag */
.flag[hidden] { display: none; }
.flag {
  display: flex; align-items: center; gap: 0.7rem;
  margin: 1.4rem 0 0; padding: 0.75rem 1rem;
  border: 1px solid var(--screen-line); border-radius: 10px;
  background: var(--screen-deep);
  font-size: 0.95rem; line-height: 1.5;
}
.flag svg { flex: none; color: var(--wipe); }
.flag a { font-weight: 600; color: #fff; }
.flag .flag-label { color: var(--wipe); font: 600 0.85rem/1 var(--display); }

/* ---------- reading column ---------- */
main { display: block; }
.column { max-width: var(--column); margin: 0 auto; padding: 0 var(--gutter); }
.byline {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.1rem 0; border-bottom: 1px solid var(--rule);
  font-size: 0.92rem; line-height: 1.45; color: var(--ink-2);
}
.byline img { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.byline a { font-weight: 600; color: var(--ink); text-decoration: none; }
.byline a:hover { text-decoration: underline; }
.prose { padding: 1.6rem 0 0.5rem; }
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 {
  font: 600 1.45rem/1.45 var(--display);
  color: var(--ink);
  margin: 2.2em 0 0.55em;
  text-wrap: balance;
}
.prose h3 { font: 600 1.15rem/1.5 var(--display); margin: 1.8em 0 0.4em; }
.prose h2 + *, .prose h3 + * { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.35em; }
.prose strong { font-weight: 700; }
.prose blockquote {
  margin: 1.6em 0; padding: 0.9rem 1.1rem;
  background: var(--paper-2); border-radius: 10px;
  font-style: italic;
}
.prose figure { margin: 1.8em 0; }
.prose figcaption { font-size: 0.88rem; color: var(--ink-2); margin-top: 0.5rem; line-height: 1.55; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.55; }
.prose th, .prose td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font: 600 0.9rem/1.4 var(--display); color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
.note {
  padding: 1rem 1.15rem; border-radius: 10px;
  background: #fff; border: 1px solid var(--rule);
  font-size: 0.97rem;
}
.note b { font-family: var(--display); font-weight: 600; }

/* numbered tracks: used only where order carries meaning (rankings, steps) */
.tracks, .prose .tracks { list-style: none; padding: 0; margin: 0; counter-reset: track; }
.tracks > li { counter-increment: track; display: grid; grid-template-columns: 3.1rem 1fr; gap: 0 0.9rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.tracks > li + li { margin-top: 0; }
.tracks > li::before {
  content: counter(track, decimal-leading-zero);
  grid-row: span 3;
  font: 800 1.7rem/1.1 var(--display);
  color: var(--screen);
  font-variant-numeric: tabular-nums;
}
.tracks h3 { margin: 0; font: 600 1.15rem/1.45 var(--display); }
.tracks p { margin: 0.3rem 0 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.3rem; border-radius: 10px;
  background: var(--screen); color: #fff; text-decoration: none;
  font: 600 1rem/1.2 var(--display);
  box-shadow: 0 6px 16px -8px rgb(12 21 70 / 0.6);
  transition: background 160ms ease-out, transform 160ms ease-out;
}
.btn:hover { background: var(--screen-deep); color: #fff; text-decoration: none; transform: translateY(-1px); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 0.5rem; }
.next-part {
  margin: 2.2rem 0 0.5rem; padding: 1.2rem; border-radius: 12px;
  background: var(--screen); color: var(--screen-ink);
}
.next-part p { margin: 0 0 0.8rem; color: var(--screen-dim); font-size: 0.95rem; }
.next-part .btn, .screen .btn-screen { background: var(--screen-ink); color: var(--screen-deep); }
.next-part .btn:hover, .screen .btn-screen:hover { background: #fff; color: var(--screen-deep); }

/* ad slots: reserved only once the ad wrapper is switched on (html.ads-on) */
.ad { display: none; }
html.ads-on .ad {
  display: grid; place-items: center;
  margin: 1.5rem auto; max-width: 100%;
  background: var(--paper-2); border-radius: 6px;
}
html.ads-on .ad-top { min-height: 250px; }
html.ads-on .ad-in { min-height: 280px; }
html.ads-on .ad::before { content: 'Advertisement'; font-size: 0.7rem; color: var(--ink-2); }

/* related + lists */
.section-title { font: 600 1.3rem/1.4 var(--display); margin: 0 0 0.6rem; }
.related { margin: 2.5rem 0 0; padding: 1.5rem 0 0; border-top: 2px solid var(--ink); }
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.entries a { font: 600 1.08rem/1.5 var(--display); color: var(--ink); text-decoration: none; }
.entries a:hover { color: var(--link); text-decoration: underline; }
.entries p { margin: 0.25rem 0 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.6; }
.entries .meta { display: block; margin-top: 0.35rem; font-size: 0.82rem; color: var(--ink-2); }
.cat-tag { font: 600 0.8rem/1 var(--display); color: var(--link); }

/* home */
.home-grid { max-width: var(--wide); margin: 0 auto; padding: 1.8rem var(--gutter) 1rem; display: grid; gap: 2.2rem; }
@media (min-width: 900px) {
  .home-grid { grid-template-columns: 1.4fr 1fr; gap: 3rem; align-items: start; }
}
.home-block + .home-block { margin-top: 2.2rem; }
.home-block .more { display: inline-block; margin-top: 0.8rem; font-weight: 600; font-size: 0.95rem; }
.lead-entry { padding: 0 0 1.2rem; border-bottom: 2px solid var(--ink); }
.lead-entry a { font: 600 1.45rem/1.45 var(--display); color: var(--ink); text-decoration: none; }
.lead-entry a:hover { color: var(--link); }
.lead-entry p { margin: 0.5rem 0 0; color: var(--ink-2); }

/* author */
.author-card { display: flex; gap: 1rem; align-items: flex-start; padding: 1.4rem 0; }
.author-card img { width: 88px; height: 88px; border-radius: 50%; flex: none; }

/* footer */
.foot {
  margin-top: 4rem;
  background: var(--screen-deep);
  color: var(--screen-dim);
  font-size: 0.9rem;
  line-height: 1.7;
}
.foot-in { max-width: var(--wide); margin: 0 auto; padding: 2.2rem var(--gutter) 2.5rem; display: grid; gap: 1.4rem; }
@media (min-width: 760px) { .foot-in { grid-template-columns: 1.2fr 1fr 1fr; } }
.foot a { color: var(--screen-ink); }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li + li { margin-top: 0.3rem; }
.foot .logo { font-size: 1.3rem; }
.foot h2 { font: 600 0.95rem/1.3 var(--display); color: #fff; margin: 0 0 0.5rem; }
.foot p { margin: 0.6rem 0 0; }

/* 404 */
.lost { max-width: var(--column); margin: 0 auto; padding: 2rem var(--gutter); }
.screen-head.narrow { max-width: var(--column); }

/* home: featured summary + numbered latest list on the screen */
.home-head { display: grid; gap: 1.6rem; }
@media (min-width: 900px) { .home-head { grid-template-columns: 1.2fr 1fr; gap: 3.5rem; align-items: start; } }
.home-head .btn-row { margin: 1.4rem 0 0; }
.screen-list-title { font: 600 1rem/1.3 var(--display); color: var(--screen-dim); margin: 0.2rem 0 0.3rem; }
.screen-list .tracks > li { border-bottom-color: var(--screen-line); padding: 0.8rem 0; grid-template-columns: 2.4rem 1fr; }
.screen-list .tracks > li::before { color: var(--screen-dim); grid-row: span 2; }
.screen-list .tracks a { font: 600 1rem/1.45 var(--display); color: #fff; text-decoration: none; }
.screen-list .tracks a:hover { text-decoration: underline; }
.screen-list .tracks span { font-size: 0.82rem; color: var(--screen-dim); }
.lost .section-title { margin-top: 2.2rem; }

/* affiliate call to action: button + its own disclosure line */
.aff, .go { margin-top: 1.4em; }
.aff small, .go small { display: block; margin-top: 0.5rem; font-size: 0.85rem; line-height: 1.55; color: var(--ink-2); }
.tracks .aff { margin: 0.9rem 0 0.2rem; }

/* ad slots also open once the Publinker wrapper script is on the page */
html:has(script[src*="js.publinker.com"]) .ad {
  display: grid; place-items: center;
  margin: 1.5rem auto; max-width: 100%;
  background: var(--paper-2); border-radius: 6px;
}
html:has(script[src*="js.publinker.com"]) .ad-top { min-height: 250px; }
html:has(script[src*="js.publinker.com"]) .ad-in { min-height: 280px; }
html:has(script[src*="js.publinker.com"]) .ad::before { content: 'Advertisement'; font-size: 0.7rem; color: var(--ink-2); }
/* one device div per slot; 1024px matches the wrapper's own mobile test (max-width: 1024px) */
@media (max-width: 1024px) { .publinker-ad[id*="_desktop_"] { display: none; } }
@media (min-width: 1025px) { .publinker-ad[id*="_mobile_"] { display: none; } }

/* P1 (Mediaholic layout): compact screen, sticky top ad, full-width CTAs */
.p1-head { padding-top: 1rem; padding-bottom: 1.4rem; }
.p1-head .sub { font-size: clamp(1.6rem, 1.1rem + 2.6vw, 2.6rem); }
html.ads-on .ad-sticky, html:has(script[src*="js.publinker.com"]) .ad-sticky { display: block; min-height: 450px; text-align: center; }
.ad-sticky > .publinker-ad { position: sticky; top: 0.5rem; }
.p1 .go .btn, .p1 .start .btn, .p1 .end-card .btn { display: flex; justify-content: center; width: 100%; padding: 1rem 1.3rem; font-size: 1.1rem; text-align: center; }
.checks, .prose .checks { list-style: none; padding: 0; }
.checks li { position: relative; padding-left: 2rem; }
.checks li::before {
  content: ''; position: absolute; left: 0; top: 0.35em;
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background: var(--screen) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 0.85rem no-repeat;
}
.quiz { margin: 1.5rem 0 0; padding: 1.2rem; border-radius: 12px; background: #fff; border: 1px solid var(--rule); text-align: center; }
.prose .quiz h2 { margin: 0; font-size: 1.3rem; }
.quiz > p { margin: 0.4rem 0 1rem; color: var(--ink-2); }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.quiz-card { display: block; border-radius: 10px; overflow: hidden; background: var(--paper-2); color: var(--ink); text-decoration: none; font: 600 0.98rem/1.4 var(--display); transition: transform 160ms ease-out, box-shadow 160ms ease-out; }
.quiz-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.quiz-card span { display: block; padding: 0.6rem 0.4rem 0.7rem; }
.quiz-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -10px rgb(12 21 70 / 0.6); text-decoration: none; }
.start, .end-card { padding: 1.2rem; border-radius: 12px; background: #fff; border: 2px solid var(--screen); }
.prose .start h3, .prose .end-card h3 { margin: 0 0 0.5rem; }
.start p, .end-card p { margin: 0 0 1rem; }
.p1 .ad-sticky { margin-bottom: 1rem; }
.p1 .prose > .quiz:first-child { margin-top: 0; }
.p1 .prose { padding-top: 0; }

.logo b { color: var(--wipe); font-weight: inherit; }
