/* =====================================================================
   Analisis Suara — presentasi interaktif
   Token warna & tipografi mengikuti judika.me (Figtree, ungu #B99AF5 / #5F3573)
   ===================================================================== */
:root {
  --bg: #111014;
  --bg-glow: rgba(185, 154, 245, .10);
  --surface: rgba(255, 255, 255, .05);
  --surface-2: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .12);
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, .74);
  --muted: rgba(255, 255, 255, .55);
  --accent: #b99af5;
  --accent-ink: #000000;
  --btn-2: #393146;
  --grid: rgba(255, 255, 255, .09);
  --axis: rgba(255, 255, 255, .45);
  /* seri data (divalidasi untuk permukaan gelap #111014) */
  --s1: #977cea;   /* tepukan */
  --s2: #0f9c8e;   /* MULTIMEDIA */
  --s3: #d4702c;   /* pulpen */
  --wave: #b99af5;
  --shadow: 0 1px 0 rgba(255, 255, 255, .14) inset, 0 18px 40px -24px rgba(0, 0, 0, .7);
  --radius: 22px;
  --font: "Figtree", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Courier Prime", ui-monospace, "Courier New", monospace;
  color-scheme: dark;
}
:root.light {
  --bg: #ffffff;
  --bg-glow: rgba(95, 53, 115, .07);
  --surface: rgba(18, 18, 18, .035);
  --surface-2: rgba(18, 18, 18, .06);
  --border: rgba(18, 18, 18, .12);
  --text: #121212;
  --text-2: rgba(18, 18, 18, .76);
  --muted: rgba(18, 18, 18, .56);
  --accent: #5f3573;
  --accent-ink: #ffffff;
  --btn-2: #e1dbe4;
  --grid: rgba(18, 18, 18, .08);
  --axis: rgba(18, 18, 18, .5);
  --s1: #7b4fc9;
  --s2: #0a9b8f;
  --s3: #d0671a;
  --wave: #5f3573;
  --shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 18px 40px -26px rgba(40, 20, 60, .35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
b { font-weight: 700; }
kbd { font-family: var(--mono); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; background: var(--surface); }

/* ---------- panggung 16:9 yang diskalakan ---------- */
.viewport { position: fixed; inset: 0; display: grid; place-items: center; background:
  radial-gradient(1200px 600px at 85% -10%, var(--bg-glow), transparent 60%),
  radial-gradient(900px 500px at -10% 110%, var(--bg-glow), transparent 60%), var(--bg); }
.stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px;
  transform: translate(-50%, -50%) scale(var(--scale, 1)); transform-origin: center; }
.slides { position: absolute; inset: 0 0 56px 0; }

.slide { position: absolute; inset: 0; padding: 44px 64px 20px; display: flex; flex-direction: column; gap: 18px;
  opacity: 0; visibility: hidden; transform: translateX(40px); transition: opacity .45s ease, transform .55s cubic-bezier(.2,.7,.2,1), visibility 0s .55s; }
.slide.active { opacity: 1; visibility: visible; transform: none; transition: opacity .45s ease, transform .55s cubic-bezier(.2,.7,.2,1); }
.slide.before { transform: translateX(-40px); }
.slide.center { justify-content: center; gap: 22px; }
.slide.center .sound-chips { margin-top: 18px; }

/* animasi masuk bertahap */
.slide .r { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .6s cubic-bezier(.2,.7,.2,1); transition-delay: 0s; }
.slide.active .r { opacity: 1; transform: none; transition-delay: calc(var(--i, 0) * 70ms + 120ms); }

@media (prefers-reduced-motion: reduce) {
  .slide, .slide .r, .slide.active, .slide.active .r { transition: none !important; transform: none !important; }
}

/* ---------- tipografi ---------- */
h1 { font-size: 112px; line-height: .92; font-weight: 900; letter-spacing: -.03em; margin: 6px 0 18px; }
h2 { font-size: 44px; line-height: 1.05; font-weight: 900; letter-spacing: -.02em; margin: 0; }
h3 { font-size: 21px; font-weight: 800; margin: 0 0 6px; }
p { margin: 0; font-size: 19px; line-height: 1.5; color: var(--text-2); }
.lead { font-size: 23px; line-height: 1.45; color: var(--text-2); max-width: 640px; }
.eyebrow, .kicker { font-family: var(--mono); font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0; }
.kicker.k1 { color: var(--s1); } .kicker.k2 { color: var(--s2); } .kicker.k3 { color: var(--s3); }
.muted { color: var(--muted); font-size: 16px; }
.fine { font-size: 14px; color: var(--muted); }
.insight { font-size: 17px; color: var(--text-2); border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; }
.desc { max-width: 520px; font-size: 17px; }
.sh { display: flex; flex-direction: column; gap: 6px; }
.sh.row { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 32px; }

/* ---------- komponen ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 22px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.card p { font-size: 17px; }
.num, .step { font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 15px; display: inline-block; margin-bottom: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; flex: 1; min-height: 0; }
.split-2.wide-left { grid-template-columns: 1.25fr 1fr; }
.col { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.col.pair { gap: 12px; }

.sound-chips { display: flex; gap: 12px; margin-top: auto; }
.chip-sound { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; font-size: 16px; color: var(--text); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.d1 { background: var(--s1); } .d3 { background: var(--s3); }

.pipeline { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; counter-reset: s; }
.pipeline li { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 16px; box-shadow: var(--shadow); }
.pipeline li:not(:last-child)::after { content: "→"; position: absolute; right: -12px; top: 50%; transform: translate(50%, -50%); color: var(--accent); font-weight: 900; z-index: 2; }
.pipeline p { font-size: 15px; line-height: 1.4; }
.note { font-size: 17px; background: var(--surface); border: 1px dashed var(--border); border-radius: 16px; padding: 16px 18px; align-self: start; }

.concept { display: flex; flex-direction: column; gap: 4px; }
.mini { width: 100%; height: 120px; margin-bottom: 8px; }
.mini-line { fill: none; stroke: var(--wave); stroke-width: 2; stroke-linecap: round; }
.mini-bar { fill: var(--wave); }
.gloss { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.gloss li { font-size: 15px; line-height: 1.45; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.gloss li b { display: block; color: var(--text); font-size: 16px; margin-bottom: 2px; }

/* tombol */
button { font-family: var(--font); cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 10px; font-weight: 600; font-size: 17px; text-decoration: none; border: 1px solid transparent; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--btn-2); color: var(--text); }
.btn:focus-visible, button:focus-visible, figure.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* lab */
.lab-buttons { display: flex; gap: 12px; }
.lab-btn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-size: 16px; transition: background .2s, transform .2s; }
.lab-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.lab-btn.playing { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.lab-btn .ico { font-size: 13px; }
.lab-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 150px 1fr; gap: 14px; flex: 1; min-height: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 10px 14px 12px; display: flex; flex-direction: column; min-height: 0; }
.panel.span2 { grid-column: span 2; }
.panel canvas { flex: 1; width: 100%; min-height: 0; display: block; }
.plabel { font-family: var(--mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* tile angka */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.tile .v { font-size: 30px; font-weight: 900; letter-spacing: -.02em; color: var(--text); }
.tile .l { font-size: 14px; color: var(--muted); }
.wavebox { flex: 1; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 8px 10px; }
.wave-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.foot .insight { max-width: 760px; }

/* svg chart */
.wave-area { stroke: none; }
.w1 { fill: var(--s1); } .w2 { fill: var(--s2); } .w3 { fill: var(--s3); }
.l1 { stroke: var(--s1); } .l2 { stroke: var(--s2); } .l3 { stroke: var(--s3); }
.grid line { stroke: var(--grid); stroke-width: 1; }
.axis text, .lbl { fill: var(--muted); font-family: var(--font); font-size: 13px; }
.axis-title { fill: var(--muted); font-size: 13px; font-family: var(--mono); letter-spacing: .04em; }
.zero { stroke: var(--axis); stroke-width: 1; }
.marker { cursor: pointer; }
.marker line { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 3 4; opacity: .6; }
.marker .pill { fill: var(--bg); stroke: var(--border); }
.marker text { fill: var(--text); font-size: 13px; font-weight: 700; font-family: var(--font); }
.marker:hover .pill, .marker:focus .pill { fill: var(--accent); stroke: transparent; }
.marker:hover text, .marker:focus text { fill: var(--accent-ink); }
.marker:focus { outline: none; }
.band { cursor: pointer; }
.band rect { fill: var(--text); opacity: .045; transition: opacity .2s; }
.band:hover rect, .band:focus rect, .band.on rect { opacity: .14; }
.band text { fill: var(--text); font-weight: 800; font-size: 16px; font-family: var(--font); }
.band text.sub { font-weight: 500; font-size: 13px; fill: var(--muted); }
.band:focus { outline: none; }
.playhead { stroke: var(--accent); stroke-width: 2; }
.bars-svg { width: 100%; height: 150px; display: block; overflow: visible; }
.val { fill: var(--text); font-size: 14px; font-weight: 700; font-family: var(--font); }
.chartbox { flex: 1; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px; }
.cmp-svg, .formant-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.series { fill: none; stroke-width: 2; stroke-linejoin: round; transition: opacity .25s; }
.series.off { opacity: 0; }
.cut rect { fill: var(--text); opacity: .05; }
.cut text { fill: var(--muted); font-size: 13px; font-family: var(--mono); }
.xhair { stroke: var(--text); stroke-width: 1; opacity: .35; }
.hdot { stroke: var(--bg); stroke-width: 2; }
.pt { stroke: var(--bg); stroke-width: 2; cursor: pointer; }
.pt-lbl { fill: var(--text); font-weight: 800; font-size: 16px; font-family: var(--font); pointer-events: none; }
.trace { fill: none; stroke: var(--s2); stroke-width: 2; stroke-dasharray: 4 4; }
.legend { display: flex; gap: 10px; }
.leg { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-size: 15px; }
.leg.off { opacity: .4; }
.leg .sw { width: 22px; height: 0; border-top: 3px solid; display: inline-block; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--mono); font-size: 15px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.chip.hl { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.hero-num .big { font-size: 76px; font-weight: 900; letter-spacing: -.03em; line-height: 1; color: var(--text); }
.hero-num .unit { font-size: 28px; font-weight: 800; color: var(--muted); margin-left: 6px; }

/* tabel */
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 16px; overflow: hidden; border-radius: 16px; border: 1px solid var(--border); }
table.data th, table.data td { padding: 10px 14px; text-align: center; border-bottom: 1px solid var(--border); color: var(--text-2); }
table.data th { background: var(--surface-2); color: var(--text); font-weight: 800; }
table.data td:first-child, table.data th:first-child { text-align: left; color: var(--text); font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }
table.data.compact td, table.data.compact th { padding: 8px 12px; font-size: 15px; }
.th-sound { display: inline-flex; align-items: center; gap: 8px; }

/* gambar & lightbox */
figure.thumb { margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); cursor: zoom-in; position: relative; transition: transform .2s, border-color .2s; }
figure.thumb:hover { transform: translateY(-2px); border-color: var(--accent); }
figure.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
figure.thumb figcaption { position: absolute; left: 8px; bottom: 8px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,.65); color: #fff; }
figure.thumb.big { flex: 1; min-height: 0; }
figure.thumb.big img { object-fit: contain; object-position: center; background: #0b0b0d; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; height: 96px; }
.thumbs.inline { grid-template-columns: repeat(2, 200px); height: 74px; position: absolute; right: 64px; top: 44px; }
.split-2 .thumbs { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
figure.thumb.wide { height: 230px; }
figure.thumb.wide img { object-fit: contain; background: #000; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(5, 4, 8, .92); display: grid; place-items: center; padding: 40px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: 84vh; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.lightbox p { color: #fff; margin-top: 12px; font-size: 15px; text-align: center; }
.lightbox .close { position: absolute; top: 18px; right: 22px; }

/* judul & referensi */
.s-title { flex-direction: row; align-items: center; gap: 40px; }
.title-wrap { flex: 1.1; display: flex; flex-direction: column; gap: 6px; }
.title-wrap .author { margin-top: 18px; }
.title-wrap .name { font-size: 22px; font-weight: 800; color: var(--text); }
.hint { margin-top: 26px; font-size: 15px; color: var(--muted); }
.hero-wave { flex: 1; height: 420px; border-radius: 28px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.hero-wave canvas { width: 100%; height: 100%; display: block; }
/* gelombang judul tergambar dari kiri ke kanan (animasi CSS, tanpa loop JS) */
.hero-wave canvas { clip-path: inset(0 100% 0 0); transition: clip-path 1.6s cubic-bezier(.4,0,.2,1) .35s; }
.slide.active .hero-wave canvas { clip-path: inset(0 0 0 0); }
.concl { margin: 6px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; counter-reset: c; }
.concl li { counter-increment: c; font-size: 19px; line-height: 1.5; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px 20px 64px; position: relative; box-shadow: var(--shadow); }
.concl li::before { content: counter(c, decimal-leading-zero); position: absolute; left: 20px; top: 20px; font-family: var(--mono); font-weight: 700; color: var(--accent); }
.ticks { margin: 6px 0 0; padding-left: 20px; }
.ticks li { font-size: 16px; line-height: 1.5; color: var(--text-2); margin-bottom: 4px; }
.thanks { justify-content: center; }
.thanks h2 { font-size: 72px; }

/* HUD */
.hud { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; display: flex; align-items: center; gap: 8px; padding: 2px 22px 0; }
.progress { position: absolute; left: 64px; right: 64px; top: -10px; height: 3px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .45s ease; }
.ic { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 20px; line-height: 1; display: inline-grid; place-items: center; }
.ic:hover { background: var(--surface-2); }
.counter { font-family: var(--mono); font-size: 14px; color: var(--muted); min-width: 64px; text-align: center; }
.spacer { flex: 1; }
.langs { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.langs button { border: 0; background: transparent; color: var(--muted); font-weight: 800; font-size: 13px; padding: 7px 12px; border-radius: 999px; }
.langs button.on { background: var(--btn-2); color: var(--text); }
:root.embedded .langs, :root.embedded #btnTheme { display: none; }

.tooltip { position: absolute; z-index: 20; pointer-events: none; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.45; box-shadow: 0 12px 30px rgba(0,0,0,.35); opacity: 0; transition: opacity .12s; white-space: nowrap; }
.tooltip.show { opacity: 1; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; }
.tooltip .t-v { margin-left: auto; padding-left: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- spektrogram interaktif ---------- */
.sx-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.sx-tabs { display: flex; gap: 10px; }
.sx-zoom { display: flex; gap: 8px; }
.lab-btn.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.sx-box { position: relative; flex: 1; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px 12px 8px; }
#sxCanvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.sx-read { flex: 1; text-align: center; font-family: var(--mono); font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; margin: 0; }
.f0row .big.dim { color: var(--muted); font-weight: 400; }

/* ---------- lab mikrofon ---------- */
.mic-top { display: flex; align-items: center; gap: 18px; }
.mic-top .btn { border: 0; cursor: pointer; }
.mic-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.15fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 14px; }
.mic-grid .f0card { grid-row: span 2; justify-content: space-between; }
.mic-grid .panel:nth-child(4) { grid-column: span 2; }
.f0row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.f0row .big { font-size: 72px; font-weight: 900; letter-spacing: -.03em; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.f0row .unit { font-size: 26px; font-weight: 800; color: var(--muted); }
.f0row .cmp { flex-basis: 100%; font-size: 16px; color: var(--text-2); min-height: 24px; }
.mic-scale { width: 100%; height: 74px; display: block; overflow: visible; }
.scale-track { fill: var(--surface-2); }
.scale-ref { stroke: var(--s1); stroke-width: 3; stroke-linecap: round; }
.scale-you { fill: var(--s2); stroke: var(--bg); stroke-width: 3; transition: cx .15s ease; }
.mic-scale .lbl.ref { fill: var(--s1); font-weight: 700; }
.mic-scale .lbl.you { fill: var(--s2); font-weight: 800; }

/* ---------- penutup ---------- */
.s-thanks { justify-content: center; align-items: center; }
.thanks-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.thanks-wrap h2 { font-size: 96px; }
