/* ============================================================
   PEC · Energy Storage Systems for Data Center
   Dark Premium Tech design system — CordiaUPC
   Base canvas: 1280 x 720 (16:9). All slides scale to fit.
   ============================================================ */

/* ---------- Font ---------- */
/* Sarabun is self-hosted via fonts/sarabun.css (linked in the HTML head). */

/* ---------- Tokens ---------- */
:root {
  /* base */
  --bg:        #080B14;
  --bg-deep:   #05070E;
  --panel:     #0E1524;
  --card:      #131C30;
  --card-2:    #18233B;
  --line:      rgba(150,180,230,0.12);
  --line-strong: rgba(150,180,230,0.22);

  /* ink */
  --ink:       #EAF1FF;
  --ink-dim:   #A9BBDC;
  --ink-mute:  #6E80A4;

  /* accents */
  --accent:    #36D6FF;   /* electric cyan */
  --accent-2:  #4B8DFF;   /* electric blue */
  --accent-3:  #8A7BFF;   /* violet */
  --glow:      rgba(54,214,255,0.55);
  --grad:      linear-gradient(120deg, #45E0FF 0%, #4B8DFF 55%, #8A7BFF 110%);
  --grad-soft: linear-gradient(120deg, rgba(69,224,255,0.16), rgba(75,141,255,0.05));

  /* semantic */
  --good:      #4FE3A6;
  --warn:      #FFC24B;
  --bad:       #FF6B7A;

  /* tiers */
  --tier1:     #36D6FF;   /* chip / rack */
  --tier2:     #4B8DFF;   /* facility UPS */
  --tier3:     #8A7BFF;   /* grid-scale */

  /* type — tuned up for CordiaUPC's small glyphs */
  --f:         'Sarabun', 'Tahoma', system-ui, sans-serif;
  --r-lg: 22px; --r-md: 16px; --r-sm: 11px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* progress bar */
#progress-track { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: rgba(150,180,230,0.10); z-index: 50; }
#progress { height: 100%; width: 0; background: var(--grad); box-shadow: 0 0 12px var(--glow); transition: width .4s ease; }

html, body {
  height: 100%;
  background: var(--bg-deep);
  font-family: var(--f);
  color: var(--ink);
  overflow: hidden;
}

/* ============================================================
   STAGE  — scales the 1280x720 canvas to the viewport
   ============================================================ */
#stage {
  position: fixed; inset: 0; overflow: hidden;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(75,141,255,0.10), transparent 60%),
    radial-gradient(1000px 700px at 110% 120%, rgba(138,123,255,0.10), transparent 60%),
    var(--bg-deep);
}
#deck {
  position: absolute; top: 50%; left: 50%;
  width: 1280px; height: 720px;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
}

.slide {
  position: absolute; inset: 0;
  width: 1280px; height: 720px;
  padding: 56px 72px 58px;
  background:
    radial-gradient(900px 520px at 8% -12%, rgba(54,214,255,0.10), transparent 55%),
    radial-gradient(760px 560px at 116% 116%, rgba(138,123,255,0.12), transparent 55%),
    linear-gradient(160deg, #0B1322 0%, #080B14 60%, #060912 100%);
  overflow: hidden;
  display: none; flex-direction: column;
}
.slide.is-active { display: flex; z-index: 2; animation: slidein .45s ease both; }
@keyframes slidein { from { opacity: 0; } to { opacity: 1; } }

/* faint engineering grid texture */
.slide::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(150,180,230,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150,180,230,0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(120% 120% at 50% 0%, #000 35%, transparent 92%);
}
.slide > * { position: relative; z-index: 1; }

/* ============================================================
   HEADER / EYEBROW / TITLE
   ============================================================ */
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-size:16.2px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
  white-space: nowrap;
}
.eyebrow::before {
  content: ""; width: 26px; height: 3px; border-radius: 3px;
  background: var(--grad); box-shadow: 0 0 12px var(--glow);
}
.eyebrow .dim { color: var(--ink-mute); font-weight: 400; letter-spacing: .12em; }

.title {
  font-size:42.5px; font-weight: 700; line-height: 1.02; color: var(--ink);
  margin-top: 12px; letter-spacing: .002em;
}
.title .accent { color: transparent; background: var(--grad); -webkit-background-clip: text; background-clip: text; }
.subtitle { font-size:23px; color: var(--ink-dim); margin-top: 10px; line-height: 1.2; font-weight: 400; }

.head { flex: 0 0 auto; margin-bottom: 22px; }
.body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; }

/* ============================================================
   FOOTER (subtle, no heavy bar)
   ============================================================ */
.foot {
  position: absolute; left: 72px; right: 72px; bottom: 22px;
  display: flex; align-items: center; justify-content: space-between;
  font-size:14px; color: var(--ink-mute); letter-spacing: .03em;
  padding-top: 12px; border-top: 1px solid var(--line);
  z-index: 1;
}
.foot__brand { display: flex; align-items: center; gap: 10px; }
.foot__brand b { color: var(--ink-dim); font-weight: 700; }
.foot__pageno { font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.foot__pageno span { color: var(--ink-mute); }

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.cols { display: grid; gap: 28px; align-items: center; }
.cols-7-5 { grid-template-columns: 7fr 5fr; }
.cols-5-7 { grid-template-columns: 5fr 7fr; }
.cols-6-6 { grid-template-columns: 1fr 1fr; }
.cols-8-4 { grid-template-columns: 8fr 4fr; }
.cols-4-8 { grid-template-columns: 4fr 8fr; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.center-y { align-items: center; }
.fill { flex: 1 1 auto; min-height: 0; }
.wrap { display: flex; flex-wrap: wrap; gap: 12px; }

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
}
.card--flat { background: var(--panel); box-shadow: none; }
.card--glow { border-color: rgba(54,214,255,0.35); box-shadow: 0 0 0 1px rgba(54,214,255,0.10), 0 20px 50px rgba(20,60,120,0.30); }
.card h3 { font-size:22.1px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.card p { font-size:18.7px; color: var(--ink-dim); line-height: 1.32; }

/* tinted accent rail (left) for emphasis cards */
.card--rail { padding-left: 26px; }
.card--rail::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px;
  border-radius: 4px; background: var(--grad); box-shadow: 0 0 14px var(--glow);
}
.rail-tier1::before { background: var(--tier1); box-shadow: 0 0 14px rgba(54,214,255,.5); }
.rail-tier2::before { background: var(--tier2); box-shadow: 0 0 14px rgba(75,141,255,.5); }
.rail-tier3::before { background: var(--tier3); box-shadow: 0 0 14px rgba(138,123,255,.5); }

/* ============================================================
   EYEBROW INDEX / NUMBER BADGES / ICON CHIPS
   ============================================================ */
.num {
  flex: 0 0 auto;
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  font-size:22.1px; font-weight: 700; color: #05101f;
  background: var(--grad); box-shadow: 0 8px 22px rgba(54,214,255,0.28);
}
.num--ghost { background: transparent; color: var(--accent); border: 1.5px solid rgba(54,214,255,.4); box-shadow: none; }

.ico {
  flex: 0 0 auto;
  width: 50px; height: 50px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--grad-soft); border: 1px solid var(--line-strong);
  color: var(--accent); font-size:21.2px;
}
.ico svg { width: 26px; height: 26px; stroke: var(--accent); fill: none; stroke-width: 1.9; }
.ico--good { color: var(--good); } .ico--good svg { stroke: var(--good); }
.ico--warn { color: var(--warn); } .ico--warn svg { stroke: var(--warn); }

/* ============================================================
   STAT / KPI CALLOUTS
   ============================================================ */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__num {
  font-size:54.4px; font-weight: 700; line-height: .98; letter-spacing: -.01em;
  color: transparent; background: var(--grad); -webkit-background-clip: text; background-clip: text;
}
.stat__num--xl { font-size:81.6px; }
.stat__label { font-size:17.8px; color: var(--ink-dim); line-height: 1.2; }
.stat__sub { font-size:14.4px; color: var(--ink-mute); }

.kpi {
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 4px;
}
.kpi .kpi__num { font-size:44.2px; font-weight: 700; color: transparent; background: var(--grad); -webkit-background-clip: text; background-clip: text; line-height: 1; }
.kpi .kpi__label { font-size:17px; color: var(--ink-dim); line-height: 1.18; }

/* ============================================================
   CALLOUT (insight / key takeaway)
   ============================================================ */
.callout {
  background: linear-gradient(120deg, rgba(54,214,255,0.10), rgba(75,141,255,0.04));
  border: 1px solid rgba(54,214,255,0.22);
  border-left: 4px solid var(--accent);
  border-radius: 14px; padding: 16px 20px;
  font-size:18.7px; color: var(--ink); line-height: 1.34;
}
.callout b, .callout .lead { color: var(--accent); font-weight: 700; }
.callout--warn { background: linear-gradient(120deg, rgba(255,194,75,0.10), transparent); border-color: rgba(255,194,75,0.3); border-left-color: var(--warn); }
.callout--warn .lead { color: var(--warn); }
.callout--good { border-left-color: var(--good); }
.callout--good .lead { color: var(--good); }

/* ============================================================
   LISTS
   ============================================================ */
.list { display: flex; flex-direction: column; gap: 12px; }
.list li { list-style: none; display: flex; gap: 12px; font-size:19.6px; color: var(--ink-dim); line-height: 1.3; }
.list li::before {
  content: ""; flex: 0 0 auto; margin-top: 11px;
  width: 9px; height: 9px; border-radius: 3px; transform: rotate(45deg);
  background: var(--accent); box-shadow: 0 0 10px var(--glow);
}
.list li b, .list li strong { color: var(--ink); font-weight: 700; }
.list--check li::before, .list--cross li::before { transform: none; border-radius: 0; width: 22px; height: 22px; margin-top: 2px; box-shadow: none; background: none; }
.list--check li::before { content: "✓"; color: var(--good); font-weight: 700; font-size:18.7px; }
.list--cross li::before { content: "✕"; color: var(--bad); font-weight: 700; font-size:18.7px; }

/* ============================================================
   TAGS / PILLS / CHIPS
   ============================================================ */
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size:15.3px; font-weight: 700; letter-spacing: .04em;
  padding: 6px 14px; border-radius: 999px;
  background: var(--grad-soft); border: 1px solid var(--line-strong); color: var(--ink-dim);
}
.tag--tier1 { color: var(--tier1); border-color: rgba(54,214,255,.4); background: rgba(54,214,255,.08); }
.tag--tier2 { color: var(--tier2); border-color: rgba(75,141,255,.4); background: rgba(75,141,255,.08); }
.tag--tier3 { color: var(--tier3); border-color: rgba(138,123,255,.4); background: rgba(138,123,255,.08); }
.tag--time { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============================================================
   TABLE
   ============================================================ */
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size:16.6px; }
table.tbl th, table.tbl td { padding: 11px 16px; text-align: left; vertical-align: middle; line-height: 1.22; color: var(--ink-dim); border-bottom: 1px solid var(--line); }
table.tbl thead th {
  background: linear-gradient(180deg, rgba(75,141,255,0.16), rgba(75,141,255,0.05));
  color: var(--ink); font-weight: 700; font-size:17px; letter-spacing: .02em;
  border-bottom: 1px solid var(--line-strong);
}
table.tbl tbody tr:nth-child(even) td { background: rgba(150,180,230,0.03); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.col-h, table.tbl th.col-h { color: var(--ink); font-weight: 700; }
table.tbl .yes { color: var(--good); font-weight: 700; }
table.tbl .no { color: var(--bad); font-weight: 700; }
table.tbl .mid { color: var(--warn); font-weight: 700; }
table.tbl caption { caption-side: bottom; font-size:12.8px; color: var(--ink-mute); text-align: left; padding: 8px 4px 0; }
.tbl--compact th, .tbl--compact td { padding: 8px 13px; font-size:15.3px; }

/* ============================================================
   FIGURES / IMAGES
   ============================================================ */
.figure { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; }
.figure img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; margin: auto; }
.figure--paper { background: #F4F7FC; padding: 14px; }            /* for white-bg charts/screenshots */
.figure--paper img { object-fit: contain; }
.figure--contain { background: var(--bg-deep); }
.figure__cap { font-size:13.6px; color: var(--ink-mute); padding: 8px 12px; line-height: 1.25; background: var(--panel); }
.figure--paper .figure__cap { color: var(--ink-mute); }
.imgbox { position: relative; overflow: hidden; min-height: 0; }
.imgbox > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }

/* photo bleed */
.bleed-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.bleed-scrim { position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(90deg, rgba(5,7,14,0.92) 0%, rgba(5,7,14,0.72) 38%, rgba(5,7,14,0.25) 100%); }
.bleed-scrim--btm { background: linear-gradient(0deg, rgba(5,7,14,0.95) 8%, rgba(5,7,14,0.55) 45%, rgba(5,7,14,0.15) 100%); }

/* ============================================================
   SOURCE / NOTE
   ============================================================ */
.src { font-size:12.8px; color: var(--ink-mute); line-height: 1.3; }
.src b { color: var(--ink-dim); font-weight: 700; }
.note { font-size:15.3px; color: var(--ink-mute); line-height: 1.3; }

/* ============================================================
   TIER STRIP / TIMELINE / PROCESS
   ============================================================ */
.flowline { display: flex; align-items: stretch; gap: 0; }
.flowline .step { flex: 1 1 0; position: relative; }
.arrow-r { display: grid; place-items: center; color: var(--accent); font-size:25.5px; padding: 0 6px; }

/* ============================================================
   TITLE / SECTION / CLOSING special layouts
   ============================================================ */
.hero { height: 100%; display: flex; flex-direction: column; justify-content: center; }
.hero__kicker { font-size:17.8px; font-weight: 700; letter-spacing: .26em; text-transform: uppercase; color: var(--accent); }
.hero__title { font-size:61.2px; font-weight: 700; line-height: 1.0; margin: 18px 0 8px; }
.hero__title .accent { color: transparent; background: var(--grad); -webkit-background-clip: text; background-clip: text; }
.hero__sub { font-size:25.5px; color: var(--ink-dim); line-height: 1.25; max-width: 60ch; }

.section-no { font-size:170px; font-weight: 700; line-height: .8; color: transparent; background: var(--grad); -webkit-background-clip: text; background-clip: text; opacity: .9; }

/* big watermark number for section dividers */
.wm {
  position: absolute; right: -10px; bottom: -70px; z-index: 0;
  font-size:391px; font-weight: 700; line-height: .7;
  color: rgba(75,141,255,0.06); letter-spacing: -.04em; pointer-events: none;
}

/* generic muted label */
.lab { font-size:15.3px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); font-weight: 700; }

/* divider hairline */
.hr { height: 1px; background: var(--line); border: none; margin: 6px 0; }

/* utility text */
.t-accent { color: var(--accent); } .t-good { color: var(--good);} .t-warn{color:var(--warn);} .t-bad{color:var(--bad);}
.t-dim { color: var(--ink-dim);} .t-mute{color:var(--ink-mute);} .t-ink{color:var(--ink);}
.b { font-weight: 700; } .i { font-style: italic; }
.center { text-align: center; } .right { text-align: right; }
.mt-a { margin-top: auto; } .nowrap{white-space:nowrap;}
.fz-sm { font-size:16.2px; } .fz-xs { font-size:13.6px; }

/* ============================================================
   UI CONTROLS  (nav bar, picker, rotate hint) — screen only
   ============================================================ */
.ui { font-family: var(--f); }

#controls {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 4px; padding: 6px 8px;
  background: rgba(10,16,28,0.80); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong); border-radius: 999px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  transition: opacity .35s ease, transform .35s ease;
}
#controls button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; min-width: 42px; padding: 0 12px; border: none; border-radius: 999px;
  background: transparent; color: var(--ink-dim); cursor: pointer; font-family: var(--f); font-size: 16px;
  transition: background .15s, color .15s;
}
#controls button:hover { background: rgba(255,255,255,0.09); color: var(--ink); }
#controls button svg { width: 20px; height: 20px; }
#controls .ctl-pdf { color: #05101f; background: var(--grad); font-weight: 700; padding: 0 16px; box-shadow: 0 4px 14px rgba(54,214,255,.3); }
#controls .ctl-pdf:hover { filter: brightness(1.08); color: #05101f; }
#controls .ctl-pdf span { font-size: 15px; letter-spacing: .04em; }
#counter { color: var(--ink-dim); font-variant-numeric: tabular-nums; font-size: 16px; padding: 0 6px; min-width: 70px; text-align: center; }
.ctl-sep { width: 1px; height: 24px; background: var(--line-strong); margin: 0 4px; }

body.idle #controls { opacity: 0; transform: translateX(-50%) translateY(12px); pointer-events: none; }

/* slide picker overlay */
#picker { position: fixed; inset: 0; z-index: 70; display: none; flex-direction: column;
  background: rgba(4,7,14,0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#picker.open { display: flex; }
.picker__head { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; color: var(--ink); font-size: 21px; border-bottom: 1px solid var(--line); }
.picker__head button { background: transparent; border: none; color: var(--ink-dim); cursor: pointer;
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; }
.picker__head button:hover { background: rgba(255,255,255,0.09); color: var(--ink); }
.picker__head svg { width: 22px; height: 22px; }
.picker__grid { flex: 1; overflow: auto; padding: 22px 26px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 12px; align-content: start; }
.ptile { display: flex; gap: 12px; align-items: center; text-align: left; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(160deg, var(--card-2), var(--card));
  color: var(--ink-dim); cursor: pointer; font-family: var(--f); min-height: 58px;
  transition: border-color .15s, transform .1s, color .15s; }
.ptile:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-2px); }
.ptile.is-cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(54,214,255,.25); color: var(--ink); }
.ptile__n { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 700; color: #05101f; background: var(--grad); font-size: 16px; font-variant-numeric: tabular-nums; }
.ptile__t { font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* title-slide PDF call-to-action */
.pdfcta { display: inline-flex; align-items: center; gap: 9px; margin-top: 24px; padding: 12px 22px;
  border: none; border-radius: 12px; cursor: pointer; background: var(--grad); color: #05101f;
  font-family: var(--f); font-weight: 700; font-size: 17px; box-shadow: 0 10px 28px rgba(54,214,255,.3); }
.pdfcta:hover { filter: brightness(1.07); }
.pdfcta svg { width: 19px; height: 19px; }

/* portrait rotate hint (mobile) — non-blocking toast */
#rotate-hint { display: none; }
body.show-rotate #rotate-hint { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
  z-index: 65; display: block; max-width: 90vw; }
.rh-box { display: flex; align-items: center; gap: 12px; background: rgba(10,16,28,0.94);
  border: 1px solid var(--line-strong); border-radius: 14px; padding: 10px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.rh-box svg { width: 26px; height: 26px; stroke: var(--accent); flex: 0 0 auto; }
.rh-box p { font-size: 15px; color: var(--ink); line-height: 1.3; }
.rh-box span { font-size: 12.5px; color: var(--ink-mute); }

/* smaller controls on short landscape phones */
@media (max-height: 430px) {
  #controls { bottom: 10px; padding: 4px 6px; gap: 2px; }
  #controls button { height: 36px; min-width: 36px; padding: 0 9px; }
  #controls button svg { width: 18px; height: 18px; }
  #counter { font-size: 14px; min-width: 58px; }
}

/* ============================================================
   PRINT  →  Export to PDF (each slide = one 16:9 page)
   ============================================================ */
@media print {
  @page { size: 1280px 720px; margin: 0; }
  html, body { overflow: visible !important; height: auto !important; background: #05070E !important; }
  #progress-track, #controls, #picker, #rotate-hint, .no-print { display: none !important; }
  #stage { position: static !important; display: block !important; inset: auto !important; background: none !important; overflow: visible !important; }
  #deck { position: static !important; transform: none !important; width: 1280px !important; height: auto !important; top: auto !important; left: auto !important; }
  .slide {
    display: flex !important; position: relative !important; inset: auto !important; top: auto !important; left: auto !important;
    width: 1280px !important; height: 720px !important; animation: none !important;
    page-break-after: always; break-after: page; page-break-inside: avoid; break-inside: avoid;
    -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;
  }
  .slide:last-child { page-break-after: auto; break-after: auto; }
}
