/* =========================================================
   สื่อการสอน: เหตุคุกคามรุนแรงในสถานศึกษา
   Tokens → Base → Layout → Components → Stages → Deck → Print
   ========================================================= */

:root{
  /* palette */
  --ink:      #0D1730;
  --ink-soft: #3A4763;
  --royal:    #1B3FA0;
  --gold:     #F5B722;
  --alert:    #D42323;
  --hide:     #6B2E9E;
  --run:      #12894C;
  --calm:     #0E6C7E;
  --paper:    #EDF1F8;
  --card:     #FFFFFF;
  --line:     #D9E1F0;

  /* accent ของแต่ละหน้า (override ราย section) */
  --accent: var(--royal);
  --accent-soft: rgba(27,63,160,.10);

  /* type */
  --font: "Prompt", "Noto Sans Thai", system-ui, sans-serif;
  --font-latin: "Chakra Petch", "Prompt", sans-serif;

  /* space & shape */
  --wrap: 1180px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 26px;
  --shadow: 0 10px 30px rgba(13,23,48,.09);
  --shadow-lg: 0 22px 60px rgba(13,23,48,.16);
}

*{ box-sizing:border-box; }

html{ scroll-behavior:smooth; scroll-padding-top:86px; }

body{
  margin:0;
  font-family:var(--font);
  font-weight:400;
  font-size:17px;
  line-height:1.7;
  color:var(--ink);
  background:var(--paper);
  -webkit-font-smoothing:antialiased;
}

h1,h2,h3,h4{ margin:0; font-weight:700; line-height:1.5; letter-spacing:0; }
p{ margin:0; }
ul,ol{ margin:0; padding:0; list-style:none; }
a{ color:inherit; text-decoration:none; }
strong{ font-weight:600; }

.skiplink{
  position:absolute; left:-9999px; top:0; z-index:200;
  background:var(--ink); color:#fff; padding:12px 18px; border-radius:0 0 var(--r-sm) 0;
}
.skiplink:focus{ left:0; }

:focus-visible{ outline:3px solid var(--gold); outline-offset:3px; border-radius:4px; }

.wrap{ width:min(100% - 40px, var(--wrap)); margin-inline:auto; }

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar{
  position:sticky; top:0; z-index:60;
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
.topbar__inner{
  width:min(100% - 32px, 1320px); margin-inline:auto;
  display:flex; align-items:center; gap:20px;
  min-height:66px; padding:8px 0;
  flex-wrap:wrap;
}
.brand{ display:flex; align-items:center; gap:12px; margin-inline-end:auto; }
.brand__mark{
  width:36px; height:36px; flex:none; display:grid; place-items:center;
  background:var(--alert); color:#fff; font-weight:800; font-size:20px;
  border-radius:10px; box-shadow:0 4px 12px rgba(212,35,35,.35);
}
.brand__text{ display:flex; flex-direction:column; line-height:1.25; }
.brand__text strong{ font-weight:600; font-size:15px; }
.brand__text small{ font-size:12px; color:var(--ink-soft); }

.topnav{ display:flex; gap:4px; flex-wrap:wrap; }
.topnav a{
  padding:7px 12px; border-radius:999px; font-size:14px; font-weight:500;
  color:var(--ink-soft); transition:background .18s, color .18s;
}
.topnav a:hover{ background:var(--accent-soft); color:var(--royal); }
.topnav a.is-current{ background:var(--ink); color:#fff; }

.topbar__tools{ display:flex; gap:8px; }

.btn{
  font-family:var(--font); font-size:14px; font-weight:600;
  padding:9px 16px; border-radius:999px; cursor:pointer;
  background:var(--royal); color:#fff; border:1px solid var(--royal);
  transition:transform .15s, background .18s;
}
.btn:hover{ transform:translateY(-1px); background:#16368b; }
.btn--ghost{ background:transparent; color:var(--royal); }
.btn--ghost:hover{ background:var(--accent-soft); }
.btn[aria-pressed="true"]{ background:var(--ink); border-color:var(--ink); }

/* =========================================================
   RAIL — แถบลำดับขั้นด้านซ้าย (signature element)
   ========================================================= */
.rail{
  position:fixed; left:22px; top:50%; transform:translateY(-50%);
  z-index:50;
}
.rail__list{ display:flex; flex-direction:column; gap:6px; position:relative; }
.rail__list::before{
  content:""; position:absolute; left:17px; top:14px; bottom:14px;
  width:2px; background:var(--line);
}
.rail a{
  position:relative; display:flex; align-items:center; gap:10px;
  padding:3px 6px 3px 0;
}
.rail__num{
  width:36px; height:36px; flex:none; z-index:1;
  display:grid; place-items:center; border-radius:50%;
  background:#fff; border:2px solid var(--line);
  font-size:14px; font-weight:700; color:var(--ink-soft);
  transition:all .25s ease;
}
.rail__label{
  font-size:13px; font-weight:600; color:var(--ink-soft);
  opacity:0; transform:translateX(-6px);
  transition:opacity .25s, transform .25s;
  white-space:nowrap;
}
.rail a:hover .rail__label{ opacity:1; transform:none; }
.rail a.is-active .rail__num{
  background:var(--rail-color,var(--royal)); border-color:var(--rail-color,var(--royal));
  color:#fff; transform:scale(1.12);
  box-shadow:0 0 0 6px color-mix(in srgb, var(--rail-color,var(--royal)) 18%, transparent);
}
.rail a.is-active .rail__label{ opacity:1; transform:none; color:var(--ink); }

.rail a[data-rail="p1"]{ --rail-color:var(--royal); }
.rail a[data-rail="p2"]{ --rail-color:var(--run); }
.rail a[data-rail="p3"]{ --rail-color:var(--hide); }
.rail a[data-rail="p4"]{ --rail-color:var(--alert); }
.rail a[data-rail="p5"]{ --rail-color:var(--calm); }

/* =========================================================
   STAGE (หนึ่ง section = หนึ่งหน้า)
   ========================================================= */
.stage{ padding:88px 0 96px; position:relative; }
.stage--p1{ --accent:var(--royal); --accent-soft:rgba(27,63,160,.10); background:var(--paper); }
.stage--p2{ --accent:var(--run);   --accent-soft:rgba(18,137,76,.10);  background:#EDF6F0; }
.stage--p3{ --accent:var(--hide);  --accent-soft:rgba(107,46,158,.10); background:#F2EDF8; }
.stage--p4{ --accent:var(--alert); --accent-soft:rgba(212,35,35,.09);  background:#FBEDED; }
.stage--p5{ --accent:var(--calm);  --accent-soft:rgba(14,108,126,.10); background:#EAF4F6; }
.stage--quiz{ --accent:var(--gold); --accent-soft:rgba(245,183,34,.16); background:var(--ink); color:#fff; }

.stage__head{ max-width:820px; margin-bottom:38px; }
.eyebrow{
  font-size:12px; font-weight:700; letter-spacing:.22em;
  color:var(--accent); text-transform:uppercase; margin-bottom:10px;
}
.eyebrow--light{ color:var(--gold); }
.stage__title{
  font-size:clamp(34px, 5.6vw, 60px); font-weight:800;
  line-height:1.45; padding-block:.06em; text-wrap:balance;
}
.stage__title .tint{ color:var(--accent); display:block; font-weight:600; font-size:.62em; line-height:1.5; margin-top:10px; }
.stage__title .latin{
  font-family:var(--font-latin); font-size:.6em; color:var(--accent);
  letter-spacing:.02em; vertical-align:.1em; white-space:nowrap;
}
.stage__sub{
  font-size:clamp(18px,2.4vw,24px); font-weight:600; color:var(--accent);
  line-height:1.6; margin-top:12px; padding-block:.04em;
}
.stage__lead{ font-size:17px; color:var(--ink-soft); margin-top:14px; font-weight:300; }

.alertbar{
  display:inline-block; margin-top:20px; line-height:1.8;
  background:var(--alert); color:#fff; font-weight:600; font-size:16px;
  padding:12px 22px; border-radius:999px;
  box-shadow:0 8px 20px rgba(212,35,35,.28);
}

/* =========================================================
   COVER
   ========================================================= */
.stage--cover{
  --accent:var(--gold);
  background:
    radial-gradient(1000px 520px at 78% -10%, rgba(245,183,34,.24), transparent 65%),
    linear-gradient(160deg, #142a63 0%, #0D1730 60%, #0A1226 100%);
  color:#fff;
  padding:120px 0 110px;
  overflow:hidden;
}
.stage--cover::after{
  content:""; position:absolute; inset:auto 0 0 0; height:8px;
  background:linear-gradient(90deg,var(--run) 0 33%,var(--hide) 33% 66%,var(--alert) 66% 100%);
}
.cover{ max-width:940px; }
.cover__title{ font-size:clamp(38px,7vw,84px); font-weight:800; line-height:1.35; padding-block:.05em; }
.cover__line1{ display:block; color:#fff; }
.cover__line2{ display:block; color:var(--gold); }
.cover__ribbon{
  display:inline-block; margin-top:16px;
  font-size:clamp(18px,2.6vw,26px); font-weight:600; letter-spacing:.02em;
  background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.22);
  padding:6px 22px; border-radius:999px;
}
.cover__lead{
  margin-top:26px; max-width:660px; font-weight:300; font-size:18px;
  color:rgba(255,255,255,.82);
}
.cover__steps{ display:flex; gap:12px; margin-top:36px; flex-wrap:wrap; }
.cover__step{
  border-inline-start:4px solid var(--accent);
  background:rgba(255,255,255,.07);
  padding:12px 22px; border-radius:0 var(--r-sm) var(--r-sm) 0;
  display:flex; flex-direction:column;
}
.cover__step span{ font-size:22px; font-weight:700; }
.cover__step em{
  font-family:var(--font-latin); font-style:normal; font-size:12px;
  letter-spacing:.18em; color:rgba(255,255,255,.6);
}
.cta{
  display:inline-block; margin-top:38px;
  background:var(--gold); color:var(--ink);
  font-weight:700; font-size:17px; padding:14px 34px; border-radius:999px;
  box-shadow:0 12px 30px rgba(245,183,34,.3);
  transition:transform .16s;
}
.cta:hover{ transform:translateY(-2px); }
.cover__note{ margin-top:26px; font-size:14px; color:rgba(255,255,255,.6); }

/* =========================================================
   GRIDS & CARDS
   ========================================================= */
.grid{ display:grid; gap:16px; }
.grid--6{ grid-template-columns:repeat(6,1fr); }
.grid--5{ grid-template-columns:repeat(5,1fr); }

.cards .card{
  background:var(--card); border:1px solid var(--line);
  border-radius:var(--r-md); padding:22px 18px;
  box-shadow:var(--shadow);
  border-top:4px solid var(--accent);
  transition:transform .18s, box-shadow .18s;
}
.cards .card:hover{ transform:translateY(-4px); box-shadow:var(--shadow-lg); }
.cards .card h3{ font-size:17px; line-height:1.6; margin-bottom:10px; color:var(--accent); }
.cards .card p{ font-size:14.5px; color:var(--ink-soft); font-weight:300; line-height:1.75; }
.cards .card--no{ border-top-color:var(--alert); }
.cards .card--no h3{ color:var(--alert); }
.cards .card--yes{ border-top-color:var(--run); }
.cards .card--yes h3{ color:var(--run); }

.cards--numbered{ counter-reset:step; }
.cards--numbered .card{ position:relative; padding-top:34px; }
.cards--numbered .card::before{
  counter-increment:step; content:counter(step);
  position:absolute; top:14px; inset-inline-start:18px;
  font-family:var(--font-latin); font-size:13px; font-weight:700;
  color:#fff; background:var(--accent);
  width:24px; height:24px; border-radius:7px; display:grid; place-items:center;
}
.cards--numbered .card--no::before{ background:var(--alert); }
.cards--numbered .card h3{ margin-top:4px; }

/* =========================================================
   SPLIT / PANELS
   ========================================================= */
.split{ display:grid; grid-template-columns:1.35fr 1fr; gap:18px; align-items:start; }
.side{ display:grid; gap:18px; }

.panel{
  background:var(--card); border:1px solid var(--line);
  border-radius:var(--r-lg); padding:26px 26px 28px;
  box-shadow:var(--shadow);
}
.panel + .panel, .split + .panel, .panel--wide{ margin-top:18px; }
.panel__title{
  font-size:18px; font-weight:700; color:var(--accent); line-height:1.6;
  padding-bottom:12px; margin-bottom:16px;
  border-bottom:2px solid var(--accent-soft);
}
.panel--dont{ background:#FFF6F6; border-color:#F3D6D6; }
.panel--dont .panel__title{ color:var(--alert); border-bottom-color:rgba(212,35,35,.14); }
.panel--muster{ background:var(--accent); color:#fff; border-color:transparent; }
.panel--muster .panel__title{ color:#fff; border-bottom-color:rgba(255,255,255,.25); }
.panel__text{ font-size:15px; font-weight:300; line-height:1.7; }
.panel--muster .panel__text{ color:rgba(255,255,255,.9); }
.panel--care{ background:#FFF4F7; border-color:#F5D8E1; }
.panel--care .panel__title{ color:#C2185B; border-bottom-color:rgba(194,24,91,.14); }

.steplist{ display:grid; gap:14px; counter-reset:s; }
.steplist li{
  display:grid; grid-template-columns:30px 1fr; gap:12px; align-items:start;
  padding-bottom:14px; border-bottom:1px dashed var(--line);
}
.steplist li:last-child{ border-bottom:0; padding-bottom:0; }
.steplist li::before{
  counter-increment:s; content:counter(s);
  width:28px; height:28px; border-radius:9px; display:grid; place-items:center;
  background:var(--accent-soft); color:var(--accent);
  font-family:var(--font-latin); font-weight:700; font-size:13px;
}
.steplist strong{ display:block; font-size:16.5px; font-weight:600; line-height:1.7; margin-bottom:2px; }
.steplist span{ display:block; font-size:14.5px; color:var(--ink-soft); font-weight:300; line-height:1.65; }

.ticklist{ display:grid; gap:11px; }
.ticklist li{
  position:relative; padding-inline-start:30px;
  font-size:15px; color:var(--ink-soft); font-weight:300; line-height:1.75;
}
.ticklist li::before{
  position:absolute; inset-inline-start:0; top:2px;
  width:20px; height:20px; border-radius:50%;
  display:grid; place-items:center; font-size:12px; font-weight:700; color:#fff;
}
.ticklist--x li::before{ content:"✕"; background:var(--alert); }
.ticklist--check li::before{ content:"✓"; background:var(--run); }
.ticklist--heart li::before{ content:"♥"; background:#E5638B; }

.chips{ display:flex; flex-wrap:wrap; gap:10px; }
.chips li{
  background:var(--accent-soft); color:var(--accent);
  font-size:15px; font-weight:600; line-height:1.7;
  padding:9px 18px; border-radius:999px;
}
.chips--tools{ margin-bottom:20px; }
.chips--tools li{ background:#fff; border:1px dashed var(--alert); color:var(--alert); }

.memo{
  background:var(--accent); color:#fff;
  border-radius:var(--r-lg); padding:24px;
  box-shadow:0 14px 34px color-mix(in srgb, var(--accent) 30%, transparent);
}
.memo__tag{
  font-size:13px; font-weight:700; letter-spacing:.12em; line-height:1.7;
  color:var(--gold); margin-bottom:10px;
}
.memo__body{ font-size:21px; font-weight:600; line-height:1.9; }

.warnbox{
  margin-top:20px; line-height:1.8; padding:16px 20px; border-radius:var(--r-sm);
  background:#FFF8E6; border-inline-start:4px solid var(--gold);
  font-size:15px; color:var(--ink-soft);
}

.minicards{ margin-top:4px; }
.minicards li{
  background:var(--accent-soft); border-radius:var(--r-md);
  padding:18px 16px; text-align:center;
}
.minicards h4{ font-size:16px; line-height:1.6; color:var(--accent); margin-bottom:8px; }
.minicards p{ font-size:13.5px; color:var(--ink-soft); font-weight:300; line-height:1.7; }

.keynote{
  margin-top:26px; background:var(--card); border:1px solid var(--line);
  border-inline-start:6px solid var(--accent);
  border-radius:var(--r-md); padding:20px 24px;
  font-size:17px; color:var(--ink-soft); font-weight:300; line-height:1.85;
}
.keynote__tag{
  display:inline-block; background:var(--accent); color:#fff;
  font-size:13px; font-weight:700; padding:3px 14px; border-radius:999px;
  margin-inline-end:10px; transform:translateY(-1px);
}
.keynote strong{ color:var(--ink); }
.keynote--alert{ border-inline-start-color:var(--alert); }
.keynote--alert .keynote__tag{ background:var(--alert); }

.footerband{
  margin-top:28px; text-align:center;
  background:var(--accent); color:#fff;
  padding:16px 24px; border-radius:999px;
  font-size:15.5px; font-weight:500; line-height:1.8;
}
.footerband--final{ border-radius:var(--r-lg); line-height:2; }
.footerband--final strong{ font-size:19px; font-weight:700; color:var(--gold); }

.draftnote{
  margin-top:18px; font-size:13px; color:var(--ink-soft);
  background:#FFFBEA; border:1px dashed var(--gold);
  padding:10px 16px; border-radius:var(--r-sm);
}

/* =========================================================
   QUIZ
   ========================================================= */
.stage--quiz .stage__title{ color:#fff; }
.stage--quiz .stage__title .tint{ color:var(--gold); }
.stage--quiz .stage__lead{ color:rgba(255,255,255,.65); }

.quizbox{ display:grid; gap:16px; }
.q{
  background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.12);
  border-radius:var(--r-md); padding:22px 24px;
}
.q__ask{ font-size:17px; font-weight:600; line-height:1.75; margin-bottom:16px; }
.q__ask b{
  font-family:var(--font-latin); color:var(--gold); margin-inline-end:8px;
}
.q__opts{ display:grid; gap:8px; }
.q__opt{
  width:100%; text-align:start; font-family:var(--font); font-size:15px;
  background:rgba(255,255,255,.06); color:#fff;
  border:1px solid rgba(255,255,255,.16); border-radius:var(--r-sm);
  padding:12px 16px; cursor:pointer; line-height:1.7;
  transition:background .16s, border-color .16s;
}
.q__opt:hover:not(:disabled){ background:rgba(255,255,255,.14); }
.q__opt:disabled{ cursor:default; opacity:.75; }
.q__opt.is-right{ background:rgba(18,137,76,.36); border-color:#2FBB74; opacity:1; }
.q__opt.is-wrong{ background:rgba(212,35,35,.32); border-color:#E96A6A; opacity:1; }
.q__why{
  margin-top:12px; font-size:14.5px; font-weight:300;
  color:rgba(255,255,255,.8);
  border-inline-start:3px solid var(--gold); padding-inline-start:14px;
}
.q__why[hidden]{ display:none; }

.quizfoot{
  margin-top:22px; display:flex; align-items:center; gap:16px; flex-wrap:wrap;
}
.quizscore{ font-size:16px; font-weight:600; color:var(--gold); margin-inline-end:auto; }
.stage--quiz .btn--ghost{ color:#fff; border-color:rgba(255,255,255,.35); }
.stage--quiz .btn--ghost:hover{ background:rgba(255,255,255,.12); }

/* =========================================================
   SITE FOOTER
   ========================================================= */
.sitefoot{ background:#08101F; color:rgba(255,255,255,.72); padding:40px 0; }
.sitefoot__line{ font-size:16px; }
.sitefoot__line strong{ color:var(--gold); font-weight:700; }
.sitefoot__meta{ margin-top:10px; font-size:13px; color:rgba(255,255,255,.42); font-weight:300; }

/* =========================================================
   PRESENTATION MODE
   ========================================================= */
body.is-presenting .rail,
body.is-presenting .sitefoot,
body.is-presenting .topnav{ display:none; }
body.is-presenting .stage{ display:none; min-height:calc(100vh - 66px); }
body.is-presenting .stage.is-slide{ display:flex; align-items:center; }
body.is-presenting .stage .wrap{ width:min(100% - 60px, 1320px); }
body.is-presenting main{ padding-bottom:80px; }
body.is-presenting .draftnote{ display:none; }

.deckbar{
  position:fixed; inset-inline:0; bottom:0; z-index:80;
  display:flex; align-items:center; justify-content:center; gap:14px;
  background:rgba(13,23,48,.94); color:#fff; padding:10px;
}
.deckbar[hidden]{ display:none; }
.deckbar__btn{
  background:rgba(255,255,255,.12); color:#fff; border:0;
  width:44px; height:36px; border-radius:8px; cursor:pointer; font-size:14px;
}
.deckbar__btn:hover{ background:rgba(255,255,255,.24); }
.deckbar__count{ font-family:var(--font-latin); font-size:14px; min-width:70px; text-align:center; }
.deckbar__exit{
  position:absolute; inset-inline-end:16px;
  background:none; border:1px solid rgba(255,255,255,.3); color:#fff;
  font-family:var(--font); font-size:13px; padding:7px 14px; border-radius:999px; cursor:pointer;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width:1380px){ .rail{ display:none; } }

@media (max-width:1080px){
  .grid--6{ grid-template-columns:repeat(3,1fr); }
  .grid--5{ grid-template-columns:repeat(3,1fr); }
}

@media (max-width:820px){
  body{ font-size:16px; }
  .stage{ padding:60px 0 68px; }
  .stage--cover{ padding:76px 0 70px; }
  .split{ grid-template-columns:1fr; }
  .grid--6, .grid--5{ grid-template-columns:repeat(2,1fr); }
  .topbar__inner{ min-height:auto; }
  .topnav{ order:3; width:100%; overflow-x:auto; flex-wrap:nowrap; padding-bottom:4px; }
  .topnav a{ white-space:nowrap; }
  .panel{ padding:20px; }
  .footerband{ border-radius:var(--r-md); }
}

@media (max-width:520px){
  .grid--6, .grid--5{ grid-template-columns:1fr; }
  .cover__steps{ gap:8px; }
  .brand__text small{ display:none; }
}

@media (prefers-reduced-motion:reduce){
  html{ scroll-behavior:auto; }
  *{ animation:none !important; transition:none !important; }
}

/* =========================================================
   PRINT — ใบความรู้แจกนักเรียน
   ========================================================= */
@media print{
  body{ background:#fff; font-size:11.5pt; }
  .topbar, .rail, .deckbar, .cta, .quizfoot, .sitefoot__meta, .draftnote{ display:none !important; }
  .stage{ display:block !important; page-break-after:always; padding:0 0 18pt; background:#fff !important; }
  .stage--cover{ background:#fff !important; color:var(--ink) !important; }
  .cover__line1, .cover__ribbon, .cover__lead, .cover__note{ color:var(--ink) !important; }
  .cover__line2{ color:var(--royal) !important; }
  .cover__step{ background:#fff; color:var(--ink); border:1px solid var(--line); }
  .stage--quiz{ background:#fff !important; color:var(--ink) !important; }
  .stage--quiz .stage__title, .stage--quiz .stage__lead{ color:var(--ink) !important; }
  .q{ background:#fff; border:1px solid var(--line); }
  .q__opt{ background:#fff; color:var(--ink); border:1px solid var(--line); }
  .card, .panel, .memo{ box-shadow:none !important; break-inside:avoid; }
  .memo{ color:#fff; }
  a{ text-decoration:none; }
}