/* AutoAuthReq legacy analysis deck — theme on top of reveal.js core (no reveal theme file). */


:root {
  --font: "Plex Thai", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  --mono: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f6f7fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --text: #1b2333;
  --muted: #5d6779;
  --faint: #8a93a6;
  --line: #dde2ec;
  --brand: #2f5bd8;
  --brand-2: #6b4fd6;
  --brand-soft: #e7edff;
  --accent-grad: linear-gradient(120deg, #2f5bd8 0%, #6b4fd6 55%, #c0459b 100%);

  --st-i: #0e8fc7;  --st-i-soft: #e3f4fb;
  --st-a: #c98100;  --st-a-soft: #fdf2dc;
  --st-e: #d23a55;  --st-e-soft: #fde7eb;
  --st-f: #14975f;  --st-f-soft: #e1f5ec;

  --ok: #14975f; --ok-soft: #e1f5ec;
  --inf: #b46a00; --inf-soft: #fdf0d8;
  --unk: #6a5fd0; --unk-soft: #ece9fd;
  --risk: #d23a55; --risk-soft: #fde7eb;

  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 8px 24px rgb(16 24 40 / 8%);
  --radius: 14px;
}

:root[data-theme="dark"] {
  --bg: #0e1220;
  --bg-2: #141a2c;
  --surface: #161d31;
  --surface-2: #1d2540;
  --text: #e8ecf5;
  --muted: #a4adc2;
  --faint: #7c86a0;
  --line: #2a3452;
  --brand: #7d9cff;
  --brand-2: #a48cff;
  --brand-soft: #1f2a4d;
  --accent-grad: linear-gradient(120deg, #7d9cff 0%, #a48cff 55%, #f07ab8 100%);

  --st-i: #4cc3f2;  --st-i-soft: #0f2c3b;
  --st-a: #f2b543;  --st-a-soft: #3a2c0d;
  --st-e: #ff6f8a;  --st-e-soft: #3f1621;
  --st-f: #45d39a;  --st-f-soft: #0f3326;

  --ok: #45d39a; --ok-soft: #0f3326;
  --inf: #f2b543; --inf-soft: #3a2c0d;
  --unk: #a99cff; --unk-soft: #26214d;
  --risk: #ff6f8a; --risk-soft: #3f1621;

  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px rgb(0 0 0 / 35%);
}

html, body { background: var(--bg); color: var(--text); }

.reveal-viewport {
  background:
    radial-gradient(1200px 600px at 110% -10%, color-mix(in oklab, var(--brand-2) 14%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in oklab, var(--brand) 12%, transparent), transparent 60%),
    var(--bg);
}

.reveal {
  font-family: var(--font);
  font-size: 30px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
}

.reveal .slides { text-align: left; }
.reveal .slides section { height: 100%; padding: 8px 4px; }
.reveal .slides > section, .reveal .slides > section > section { box-sizing: border-box; }

.reveal h1, .reveal h2, .reveal h3, .reveal h4 {
  font-family: var(--font);
  color: var(--text);
  margin: 0 0 0.45em;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-transform: none;
}
.reveal h1 { font-size: 2.3em; font-weight: 700; }
.reveal h2 { font-size: 1.45em; font-weight: 700; }
.reveal h3 { font-size: 1.05em; font-weight: 600; }
.reveal h4 { font-size: 0.85em; font-weight: 600; color: var(--muted); }
.reveal p { margin: 0 0 0.6em; }
.reveal a { color: var(--brand); text-decoration: none; }
.reveal a:hover { text-decoration: underline; }
.reveal strong { font-weight: 600; }
.reveal ul, .reveal ol { margin: 0 0 0.6em 1.1em; display: block; }
.reveal li { margin: 0.18em 0; }
.reveal code, .reveal kbd {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05em 0.35em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.reveal pre {
  width: 100%;
  margin: 0.3em 0 0.6em;
  box-shadow: none;
  font-size: 0.56em;
  line-height: 1.55;
}
.reveal pre code {
  display: block;
  padding: 0.9em 1.1em;
  max-height: 420px;
  border-radius: 12px;
  background: var(--surface-2);
  white-space: pre;
  overflow: auto;
}
.reveal pre code .hl { background: color-mix(in oklab, var(--risk) 22%, transparent); border-radius: 3px; }
.reveal pre code .cm { color: var(--faint); }
.reveal pre code .kw { color: var(--brand-2); font-weight: 500; }
.reveal pre code .st { color: var(--st-f); }

/* Section kicker + title block */
.kicker {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-size: 0.5em; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.35em;
}
.kicker .num {
  display: inline-grid; place-items: center;
  min-width: 1.9em; height: 1.9em; padding: 0 0.4em; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); letter-spacing: 0;
}
.lede { font-size: 0.78em; color: var(--muted); max-width: 46em; }
.small { font-size: 0.66em; }
.tiny { font-size: 0.52em; color: var(--muted); }
.muted { color: var(--muted); }
.grad-text { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Layout helpers */
.cols { display: grid; gap: 22px; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); align-items: start; }
.cols.c3 { --n: 3; } .cols.c4 { --n: 4; }
.cols.w-60-40 { grid-template-columns: 3fr 2fr; }
.cols.w-40-60 { grid-template-columns: 2fr 3fr; }
.stack > * + * { margin-top: 14px; }
.center-v { display: flex; flex-direction: column; justify-content: center; height: 100%; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  font-size: 0.66em;
}
.card h3 { font-size: 1.15em; margin-bottom: 0.3em; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card.tint-i { border-top: 4px solid var(--st-i); }
.card.tint-a { border-top: 4px solid var(--st-a); }
.card.tint-e { border-top: 4px solid var(--st-e); }
.card.tint-f { border-top: 4px solid var(--st-f); }
.card.tint-brand { border-top: 4px solid var(--brand); }
.card.tint-risk { border-left: 5px solid var(--risk); }
.icon-badge {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand); font-size: 22px; margin-bottom: 8px;
}

.stat { font-size: 2.1em; font-weight: 700; line-height: 1.1; }
.stat small { font-size: 0.4em; font-weight: 500; color: var(--muted); }

/* Status chips */
.chip {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-size: 0.8em; font-weight: 600; line-height: 1;
  padding: 0.35em 0.65em; border-radius: 999px; white-space: nowrap;
}
.chip::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.chip.i { color: var(--st-i); background: var(--st-i-soft); }
.chip.a { color: var(--st-a); background: var(--st-a-soft); }
.chip.e { color: var(--st-e); background: var(--st-e-soft); }
.chip.f { color: var(--st-f); background: var(--st-f-soft); }
.chip.y { color: var(--muted); background: var(--surface-2); }

/* Evidence badges: ✅ confirmed / 🔶 inferred / ❓ unknown */
.ev {
  display: inline-flex; align-items: center; gap: 0.3em;
  font-size: 0.5em; font-weight: 600; vertical-align: middle;
  padding: 0.25em 0.6em; border-radius: 999px; cursor: help; white-space: nowrap;
  border: 1px solid transparent;
}
.ev.ok { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in oklab, var(--ok) 30%, transparent); }
.ev.inf { color: var(--inf); background: var(--inf-soft); border-color: color-mix(in oklab, var(--inf) 30%, transparent); }
.ev.unk { color: var(--unk); background: var(--unk-soft); border-color: color-mix(in oklab, var(--unk) 30%, transparent); }
.card .ev, td .ev, li .ev { font-size: 0.78em; }
.src { font-size: 0.48em; color: var(--faint); font-family: var(--mono); margin-top: 0.5em; }
.slide-ev { position: absolute; top: 6px; right: 6px; display: flex; gap: 6px; z-index: 2; }

/* Tables */
.reveal table.t {
  border-collapse: separate; border-spacing: 0; width: 100%;
  font-size: 0.56em; margin: 0.2em 0 0.6em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow);
}
.reveal table.t th, .reveal table.t td { border: 0; border-bottom: 1px solid var(--line); padding: 0.5em 0.75em; text-align: left; vertical-align: top; }
.reveal table.t th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 0.92em; }
.reveal table.t tr:last-child td { border-bottom: 0; }
.reveal table.t td.num, .reveal table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.reveal table.t code { font-size: 0.9em; }

/* Mermaid diagrams */
.diagram {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex; align-items: center; justify-content: center;
  min-height: 120px;
}
.diagram .mermaid-src { display: none; }
.diagram svg { display: block; width: 100%; height: auto; max-height: var(--max-h, 560px); }
.diagram.loading::after { content: "กำลังวาด diagram…"; font-size: 0.5em; color: var(--faint); }
.diagram.error { font-size: 0.5em; color: var(--risk); white-space: pre-wrap; font-family: var(--mono); }
.diagram-tools {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity .2s;
}
.diagram:hover .diagram-tools, .diagram:focus-within .diagram-tools { opacity: 1; }
.diagram-tools button {
  font: 600 13px/1 var(--font); color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; cursor: pointer;
}
.diagram-tools button:hover { color: var(--brand); border-color: var(--brand); }
.diagram-caption { font-size: 0.5em; color: var(--muted); margin-top: 0.5em; text-align: center; }

/* Step highlighting inside diagrams (driven by fragments via data-step) */
.diagram svg .node, .diagram svg .edgePath, .diagram svg .flowchart-link, .diagram svg .edgeLabel, .diagram svg g.cluster {
  transition: opacity .35s ease, filter .35s ease;
}
.diagram.stepping svg .node:not(.step-on), .diagram.stepping svg .edgeLabel:not(.step-on) { opacity: .28; }
.diagram.stepping svg .flowchart-link:not(.step-on), .diagram.stepping svg .edgePath:not(.step-on) { opacity: .22; }
.diagram svg .node.step-now rect, .diagram svg .node.step-now polygon, .diagram svg .node.step-now circle, .diagram svg .node.step-now path {
  stroke: var(--brand) !important; stroke-width: 3px !important;
}
.diagram svg .node.step-now { filter: drop-shadow(0 0 10px color-mix(in oklab, var(--brand) 55%, transparent)); }

/* Step list next to a stepping diagram */
.steps { counter-reset: s; list-style: none; margin: 0 !important; padding: 0; font-size: 0.6em; }
.steps li {
  counter-increment: s; position: relative; padding: 0.55em 0.8em 0.55em 2.6em; margin: 0 0 0.45em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.steps li::before {
  content: counter(s); position: absolute; left: 0.75em; top: 0.6em;
  width: 1.45em; height: 1.45em; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 0.9em;
}
.steps li.current-fragment { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 18%, transparent); }
.steps li b { display: block; }

/* Callouts */
.callout {
  font-size: 0.62em; padding: 14px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2);
}
.callout.warn { background: var(--risk-soft); border-color: color-mix(in oklab, var(--risk) 35%, transparent); }
.callout.note { background: var(--brand-soft); border-color: color-mix(in oklab, var(--brand) 30%, transparent); }
.callout.inf { background: var(--inf-soft); border-color: color-mix(in oklab, var(--inf) 35%, transparent); }

/* Title slide */
.title-slide { display: flex; flex-direction: column; justify-content: center; height: 100%; }
.title-slide h1 { font-size: 2.6em; margin-bottom: 0.2em; }
.title-slide .meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.2em; font-size: 0.55em; }
.title-slide .meta span { background: var(--surface); border: 1px solid var(--line); padding: 0.4em 0.85em; border-radius: 999px; }
.orb {
  position: absolute; border-radius: 50%; filter: blur(2px); opacity: .85; pointer-events: none;
  background: var(--accent-grad);
  animation: float 9s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-18px) } }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } }

/* Agenda */
.agenda { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; font-size: 0.58em; }
.agenda a {
  display: flex; gap: 0.7em; align-items: center; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.7em 0.9em;
  transition: transform .15s, border-color .15s;
}
.agenda a:hover { transform: translateY(-2px); border-color: var(--brand); text-decoration: none; }
.agenda .n { font-weight: 700; color: var(--brand); min-width: 1.6em; }

/* Windows-classic mockups built from the .dfm files */
.win {
  --w-face: #d4d0c8; --w-dark: #808080; --w-light: #ffffff; --w-text: #000;
  font-family: Tahoma, "Leelawadee UI", "Plex Thai", sans-serif; font-size: 11px; color: var(--w-text);
  background: var(--w-face); border: 2px solid; border-color: var(--w-light) var(--w-dark) var(--w-dark) var(--w-light);
  box-shadow: var(--shadow); border-radius: 4px; overflow: hidden; position: relative; user-select: none;
}
.win .titlebar {
  background: linear-gradient(90deg, #0a246a, #a6caf0); color: #fff; font-weight: 700; padding: 4px 8px; font-size: 12px;
  display: flex; justify-content: space-between;
}
.win .titlebar i { font-style: normal; letter-spacing: 4px; }
.win .body { padding: 6px; display: grid; gap: 6px; }
.win .grp { border: 1px solid var(--w-dark); box-shadow: 1px 1px 0 var(--w-light) inset; padding: 10px 8px 6px; position: relative; }
.win .grp > .lg { position: absolute; top: -8px; left: 8px; background: var(--w-face); padding: 0 4px; font-weight: 700; }
.win .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.win .lbl { min-width: 92px; text-align: right; }
.win .inp { background: #fff; border: 2px inset #e0e0e0; height: 18px; min-width: 80px; padding: 0 3px; line-height: 16px; overflow: hidden; white-space: nowrap; }
.win .btn {
  background: var(--w-face); border: 2px solid; border-color: var(--w-light) var(--w-dark) var(--w-dark) var(--w-light);
  padding: 3px 10px; font-weight: 700; white-space: nowrap;
}
.win .btn.tall { padding: 10px 12px; }
.win .grid { background: #fff; border: 2px inset #e0e0e0; height: 86px; overflow: hidden; }
.win .grid .hd { display: flex; background: var(--w-face); border-bottom: 1px solid var(--w-dark); }
.win .grid .hd span { flex: 1; padding: 2px 4px; border-right: 1px solid var(--w-dark); white-space: nowrap; overflow: hidden; }
.win .grid .rw { display: flex; border-bottom: 1px solid #eee; }
.win .grid .rw span { flex: 1; padding: 2px 4px; white-space: nowrap; overflow: hidden; color: #333; }
.win .toolbar { display: flex; gap: 4px; padding: 4px 6px; border-top: 1px solid var(--w-dark); flex-wrap: wrap; }
.win .status { border-top: 1px solid var(--w-dark); padding: 2px 6px; color: #333; }
.win .red { color: #c00; font-weight: 700; }
.win .hot { position: relative; outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .3s; }
.mock-wrap { position: relative; }
.pin {
  position: absolute; z-index: 3; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; font: 700 14px/26px var(--font); text-align: center;
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 30%, transparent);
}
.pin.fragment.visible { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.4) } 70% { transform: scale(1.15) } 100% { transform: scale(1) } }
.pin-list { list-style: none; margin: 0 !important; padding: 0; font-size: 0.56em; }
.pin-list li { display: flex; gap: 0.6em; align-items: flex-start; margin-bottom: 0.55em; }
.pin-list li .n {
  flex: none; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 0.85em;
}

/* Timeline */
.tl { position: relative; margin: 0.4em 0 0 0.3em; padding-left: 1.4em; font-size: 0.56em; }
.tl::before { content: ""; position: absolute; left: 0.35em; top: 0.4em; bottom: 0.4em; width: 3px; border-radius: 3px; background: var(--accent-grad); }
.tl .it { position: relative; margin-bottom: 0.65em; }
.tl .it::before {
  content: ""; position: absolute; left: -1.33em; top: 0.42em; width: 0.8em; height: 0.8em; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--brand);
}
.tl .it.big::before { background: var(--brand); }
.tl .when { font-family: var(--mono); color: var(--muted); font-size: 0.9em; }
.tl .ver { font-weight: 700; color: var(--brand); margin: 0 0.4em; }

/* Overlay: zoomed diagram + Mermaid source */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: color-mix(in oklab, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
}
.overlay.open { display: block; }
.overlay .bar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: center; padding: 10px 14px;
  font: 500 14px/1 var(--font); color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface);
}
.overlay .bar .sp { flex: 1; }
.overlay .bar button {
  font: 600 14px/1 var(--font); color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; cursor: pointer;
}
.overlay .bar button:hover { border-color: var(--brand); color: var(--brand); }
.overlay .stage { position: absolute; inset: 52px 0 0 0; overflow: hidden; cursor: grab; touch-action: none; }
.overlay .stage.dragging { cursor: grabbing; }
.overlay .stage .inner { transform-origin: 0 0; position: absolute; left: 0; top: 0; }
.overlay .stage svg { max-width: none !important; max-height: none !important; }
.overlay pre {
  position: absolute; inset: 52px 0 0 0; margin: 0; padding: 18px 22px; overflow: auto;
  font: 14px/1.6 var(--mono); color: var(--text); background: var(--surface-2);
}

/* Floating UI: theme toggle + menu */
.hud { position: fixed; z-index: 30; left: 16px; bottom: 14px; display: flex; gap: 8px; }
.hud button {
  font: 600 13px/1 var(--font); color: var(--muted); background: color-mix(in oklab, var(--surface) 85%, transparent);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer; backdrop-filter: blur(6px);
}
.hud button:hover { color: var(--brand); border-color: var(--brand); }
.toc {
  position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; width: min(420px, 92vw);
  background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow);
  transform: translateX(-105%); transition: transform .3s ease; padding: 18px; overflow: auto;
  font-family: var(--font);
}
.toc.open { transform: none; }
.toc h3 { margin: 0 0 12px; font-size: 16px; color: var(--muted); }
.toc a {
  display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 15px;
}
.toc a:hover, .toc a.active { background: var(--brand-soft); color: var(--brand); }
.toc a .n { font-weight: 700; color: var(--brand); min-width: 26px; }
.toc .keys { margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.9; }
.toc kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }

/* Reveal chrome */
.reveal .progress { height: 4px; color: var(--brand); }
.reveal .progress span { background: var(--accent-grad); }
.reveal .controls { color: var(--brand); }
.reveal .slide-number {
  background: transparent; color: var(--faint); font: 500 13px/1 var(--mono); right: 18px; bottom: 14px;
}
.down-hint {
  position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
  font-size: 0.42em; color: var(--faint); display: flex; align-items: center; gap: 0.4em;
}
.down-hint::after { content: "↓"; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateY(0) } 50% { transform: translateY(5px) } }

/* Custom fragment effects */
.reveal .fragment.rise { opacity: 0; transform: translateY(18px); transition: all .45s cubic-bezier(.2,.7,.2,1); }
.reveal .fragment.rise.visible { opacity: 1; transform: none; }
.reveal .fragment.blur-in { opacity: 0; filter: blur(8px); transition: all .5s ease; }
.reveal .fragment.blur-in.visible { opacity: 1; filter: none; }
.reveal .fragment.step-marker { display: none; }

/* Print / PDF */
@media print {
  .hud, .toc, .overlay, .diagram-tools, .down-hint { display: none !important; }
}

/* Six step cards in one row under a wide diagram */
.steps.row6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 14px !important; font-size: 0.5em; }
.steps.row6 li { margin: 0; padding: 2.4em 0.8em 0.7em; }
.steps.row6 li::before { top: 0.7em; left: 0.8em; }
