/* =========================================================
   PDF SMKN 2 Pekalongan
   Palet diambil dari logo sekolah: biru tua, emas padi, merah pita.
   ========================================================= */
:root {
  --navy-950: #06123d;
  --navy-900: #0a1b55;
  --navy-800: #102674;
  --cobalt: #2a4fe0;
  --gold: #ffc52e;
  --gold-soft: #ffe49a;
  --red: #e3262f;
  --paper: #f4f6fc;
  --ink: #0a1b55;
  --text: #eaf0ff;
  --muted: #a8b6e8;
  --line: rgba(234, 240, 255, 0.14);
  --display: "Big Shoulders", "Big Shoulders Display", Impact, "Arial Narrow", sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--navy-900);
  /* kertas kalkir / blueprint bengkel teknik */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    linear-gradient(rgba(234,240,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(234,240,255,.05) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }

a { color: inherit; }

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

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(env(safe-area-inset-top, 0px) + .75rem) clamp(1rem, 4vw, 2.5rem) .75rem;
  background: rgba(6, 18, 61, .88);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand img { display: block; width: 40px; height: auto; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.6rem; letter-spacing: .02em; line-height: 1; }
.brand-name b { color: var(--gold); font-weight: 900; margin-left: .15em; }

.nav { display: flex; gap: .25rem; }
.nav a {
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  padding: .5rem .85rem;
  border: 2px solid transparent;
  color: var(--muted);
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--navy-950); background: var(--gold); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem);
}
.display {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.5rem, 6.4vw, 5.6rem);
  line-height: .88;
  letter-spacing: -.01em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}
.display span { display: block; white-space: nowrap; }
.lede { max-width: 34em; margin: 0; color: var(--muted); font-size: 1.15rem; }

/* demo lembar dokumen: satu kali pindai saat halaman dibuka */
.sheet-demo { margin: 0; justify-self: center; width: min(100%, 340px); }
.sheet {
  position: relative;
  aspect-ratio: 210 / 250;
  background: var(--paper);
  color: var(--ink);
  transform: rotate(-2.5deg);
  box-shadow: 14px 14px 0 var(--gold), 14px 14px 0 2px var(--navy-950);
  overflow: hidden;
}
.sheet-layer { position: absolute; inset: 0; padding: 0 0 1rem; background: var(--paper); }
.layer-dst { clip-path: inset(0 0 100% 0); animation: reveal 2.2s cubic-bezier(.65,0,.35,1) .7s forwards; }
.s-band {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--cobalt); color: #fff;
  padding: 1.05rem 1rem;
  font-family: var(--display); font-weight: 800; font-size: 1.35rem; line-height: 1;
}
.s-seal { width: 30px; height: 30px; border-radius: 50%; background: var(--gold); box-shadow: inset 0 0 0 4px var(--cobalt), inset 0 0 0 6px #fff; flex: none; }
.s-p { margin: .9rem 1rem 0; font-size: .82rem; line-height: 1.45; }
.s-p.sm { margin: 0; font-size: .74rem; }
.s-cols { display: grid; grid-template-columns: 70px 1fr; gap: .7rem; margin: .9rem 1rem 0; align-items: start; }
.s-img { height: 62px; background: repeating-linear-gradient(135deg, #c9d3f2 0 6px, #dfe5f7 6px 12px); border: 1px solid #b8c4ec; }
.s-end { margin: 1.4rem 1rem 0; font-weight: 700; text-align: center; }
.s-table {
  display: grid; grid-template-columns: 1fr auto;
  margin: 1rem 1rem 0; border: 1.5px solid var(--ink); font-size: .74rem;
}
.s-table > * { padding: .35rem .5rem; border-bottom: 1px solid #b8c4ec; }
.s-table b { border-left: 1px solid #b8c4ec; font-weight: 700; }
.s-table > :nth-last-child(-n+2) { border-bottom: 0; }
.scan {
  position: absolute; left: -10%; right: -10%; top: 0; height: 4px;
  background: var(--gold);
  box-shadow: 0 0 18px 6px rgba(255, 197, 46, .55);
  opacity: 0;
  animation: scan 2.2s cubic-bezier(.65,0,.35,1) .7s forwards;
}
.sheet-tag { display: flex; justify-content: flex-end; gap: .4rem; margin-top: 1.6rem; font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.sheet-tag span { padding: .1rem .5rem; border: 2px solid var(--muted); color: var(--muted); }
.sheet-tag span:last-child { border-color: var(--gold); color: var(--navy-950); background: var(--gold); }

@keyframes reveal { to { clip-path: inset(0 0 0 0); } }
@keyframes scan {
  0% { top: 0; opacity: 1; }
  92% { top: 100%; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ---------- panel & form ---------- */
.tool { display: grid; gap: 1.25rem; padding-bottom: 4rem; }
.panel {
  background: var(--navy-950);
  border: 2px solid var(--line);
  padding: clamp(1.1rem, 3vw, 2rem);
}
.panel[hidden] { display: none; }
.panel { scroll-margin-top: 90px; }

.drop {
  position: relative;
  display: grid;
  justify-items: start;
  gap: .35rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 3px dashed var(--gold);
  cursor: pointer;
  transition: background-color .15s, border-style .15s;
}
.drop:hover, .drop.is-over { background: rgba(255, 197, 46, .08); }
.drop.has-file { border-style: solid; background: rgba(255, 197, 46, .06); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.drop-icon { color: var(--gold); }
.drop-main { font-family: var(--display); font-weight: 800; font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1.05; overflow-wrap: anywhere; }
.drop-sub { color: var(--muted); font-size: .95rem; }

.langs { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: end; margin: 1.5rem 0; }
.field { display: grid; gap: .4rem; position: relative; }
.field > label, legend { font-weight: 600; font-size: .95rem; color: var(--muted); padding: 0; }

select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--navy-900);
  border: 2px solid var(--line);
  border-radius: 0;
  padding: .75rem .9rem;
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}
select:hover, textarea:hover { border-color: rgba(234, 240, 255, .32); }
textarea { resize: vertical; min-height: 12rem; line-height: 1.6; }
.counter { justify-self: end; font-size: .85rem; color: var(--muted); }

.swap {
  width: 48px; height: 50px;
  display: grid; place-items: center;
  color: var(--gold);
  background: transparent;
  border: 2px solid var(--line);
  cursor: pointer;
}
.swap:hover { border-color: var(--gold); }

.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: .01em;
  line-height: 1; text-decoration: none;
  padding: .85rem 1.4rem;
  border: 2px solid var(--gold);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.btn-primary { background: var(--gold); color: var(--navy-950); box-shadow: 5px 5px 0 var(--red); }
.btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--red); }
.btn-primary:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--red); }
.btn-primary:disabled { opacity: .55; cursor: progress; transform: none; box-shadow: 5px 5px 0 var(--red); }
.btn-big { width: 100%; font-size: clamp(1.5rem, 3vw, 2rem); padding: 1.05rem 1.5rem; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); font-size: 1.15rem; }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

.form-error {
  margin: 1rem 0 0;
  padding: .75rem 1rem;
  border-left: 5px solid var(--red);
  background: rgba(227, 38, 47, .14);
  font-weight: 500;
}

/* ---------- progres (pita peringatan bengkel) ---------- */
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .8rem; }
.progress-head span { font-weight: 600; }
.progress-head strong { font-family: var(--display); font-weight: 900; font-size: 2.6rem; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.bar { height: 22px; border: 2px solid var(--gold); background: var(--navy-900); overflow: hidden; }
.bar span {
  display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(-45deg, var(--gold) 0 14px, var(--navy-950) 14px 28px);
  background-size: 40px 40px;
  animation: stripes .8s linear infinite;
  transition: width .4s ease;
}
@keyframes stripes { to { background-position: 40px 0; } }
.hint { margin: .8rem 0 0; color: var(--muted); font-size: .92rem; }

/* ---------- hasil ---------- */
.result-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 2rem; margin-bottom: 1.25rem; }
.result-head h2 { font-family: var(--display); font-weight: 900; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1; margin: 0 0 .3rem; }
.result-head p { margin: 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }
iframe { display: block; width: 100%; height: min(78vh, 900px); border: 2px solid var(--line); background: #fff; }
audio { width: 100%; }

/* ---------- teks ke suara ---------- */
.hero-tts { grid-template-columns: 1fr .8fr; }
.wave { display: flex; align-items: center; gap: 5px; height: 180px; }
.wave span {
  flex: 1;
  height: var(--h);
  background: var(--gold);
  transform-origin: center;
}
.wave span:nth-child(3n) { background: var(--muted); }
.wave span:nth-child(7n) { background: var(--red); }
body.is-playing .wave span { animation: eq .9s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -70ms); }
@keyframes eq { from { transform: scaleY(.35); } to { transform: scaleY(1); } }

.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1.5rem; margin: 1.5rem 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { margin-bottom: .45rem; }
.opts .wide { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-block;
  padding: .55rem .9rem;
  border: 2px solid var(--line);
  font-weight: 600; font-size: .95rem;
  cursor: pointer;
  user-select: none;
}
.chip input:hover + span { border-color: rgba(234, 240, 255, .4); }
.chip input:checked + span { background: var(--gold); border-color: var(--gold); color: var(--navy-950); }
.chip input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- footer ---------- */
.footer { border-top: 2px solid var(--line); padding: 1.25rem clamp(1rem, 4vw, 2.5rem); color: var(--muted); font-size: .9rem; background: var(--navy-950); }
.footer p { max-width: 1180px; margin: 0 auto; }

/* ---------- responsif ---------- */
@media (max-width: 860px) {
  .hero, .hero-tts { grid-template-columns: 1fr; }
  .sheet-demo { width: min(78%, 300px); justify-self: start; margin-left: .5rem; }
  .wave { height: 110px; }
}
@media (max-width: 600px) {
  .brand-name { font-size: 1.35rem; }
  .nav a { padding: .45rem .55rem; font-size: .88rem; }
  .langs { grid-template-columns: 1fr; }
  .swap { justify-self: center; transform: rotate(90deg); }
  .opts { grid-template-columns: 1fr; }
  .actions { width: 100%; }
  .actions > * { flex: 1 1 100%; }
  iframe { height: 70vh; }
}
@media (max-width: 400px) {
  .brand img { width: 32px; }
  .brand-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .layer-dst { clip-path: none; }
  .scan { display: none; }
}

/* ---------- beranda: daftar alat ---------- */
.hero-home { grid-template-columns: 1fr; padding-bottom: 2rem; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 4rem;
}
.tool-card {
  display: grid;
  align-content: start;
  gap: .5rem;
  min-height: 190px;
  padding: 1.5rem;
  text-decoration: none;
  background: var(--navy-950);
  border: 2px solid var(--line);
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.tool-card:hover { border-color: var(--gold); transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--gold); }
.tool-icon { color: var(--gold); margin-bottom: .5rem; }
.tool-title { font-family: var(--display); font-weight: 900; font-size: 2rem; line-height: 1; }
.tool-desc { color: var(--muted); }
.tool-card.is-main { grid-column: span 2; grid-row: span 2; background: var(--gold); border-color: var(--gold); color: var(--navy-950); padding: 2rem; }
.tool-card.is-main .tool-icon { color: var(--navy-950); }
.tool-card.is-main .tool-icon svg { width: 72px; height: 72px; }
.tool-card.is-main .tool-title { font-size: clamp(2.6rem, 5vw, 4.2rem); margin-top: auto; }
.tool-card.is-main .tool-desc { color: var(--navy-800); font-size: 1.15rem; font-weight: 500; }
.tool-card.is-main:hover { box-shadow: 6px 6px 0 var(--red); }

/* ---------- halaman alat ---------- */
.hero-tool { grid-template-columns: auto 1fr; align-items: center; gap: 1.5rem; }
.hero-icon { color: var(--gold); display: grid; place-items: center; width: 120px; height: 120px; border: 3px solid var(--gold); }
.hero-tool .display { margin-bottom: .75rem; }
.tool-opts { margin: 1.5rem 0; }
.tool-opts.opts { grid-template-columns: auto 1fr; align-items: end; }
input[type="text"] {
  width: 100%; font: inherit; color: var(--text); background: var(--navy-900);
  border: 2px solid var(--line); border-radius: 0; padding: .75rem .9rem;
}
input[type="text"]:hover { border-color: rgba(234, 240, 255, .32); }
input::placeholder, textarea::placeholder { color: rgba(168, 182, 232, .7); }
iframe[hidden] { display: none; }

@media (max-width: 860px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-card.is-main { grid-row: auto; }
}
@media (max-width: 600px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card.is-main { grid-column: auto; }
  .tool-card { min-height: 0; }
  .hero-tool { grid-template-columns: 1fr; }
  .hero-icon { width: 84px; height: 84px; }
  .hero-icon svg { width: 52px; height: 52px; }
  .tool-opts.opts { grid-template-columns: 1fr; }
}

.hero-home { gap: 0; }
.tool-card.is-main { align-content: space-between; }
.nav a { white-space: nowrap; }
@media (max-width: 600px) {
  .brand-name { display: none; }
  .nav a { padding: .45rem .5rem; font-size: .85rem; }
}
