/* ============================================================
   SIKEDA — Kartu Tanda Anggota (front + back)
   Semua ukuran memakai satuan container-query (cqw = 1% lebar
   kartu) sehingga render identik di: pratinjau browser, PDF
   (puppeteer), dan master cetak ID-1 85,60 × 53,98 mm.
   Rasio kartu: 1291 × 816 px template (≈ ID-1 85.6 × 54 mm).
   ============================================================ */

/* Pembungkus opsional = container query (pratinjau browser).
   .kta-card sendiri juga container, jadi cqw selalu valid. */
.kta-wrap {
  container-type: inline-size;
  width: 100%;
}

.kta-card {
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  aspect-ratio: 1291 / 816;
  /* radius sudut ID-1: 3,18 mm → 3,716% lebar / 5,891% tinggi (lingkaran sempurna) */
  border-radius: 3.716% / 5.891%;
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
  color: #191300;
}

/* Lapisan wajah kartu (depan/belakang) menempel penuh di container.
   Shadow kartu ditaruh di sini agar cqw mengacu lebar kartu. */
.kta-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  box-shadow:
    0 2.8cqw 6cqw -3cqw rgba(23, 16, 0, .55),
    inset 0 0 0 .25cqw rgba(255, 255, 255, .38);
}

/* ============================================================
   SISI DEPAN — replika template resmi (kuning, pita bendera,
   lambang, pohon, banner). Foto / data / QR ditempatkan di atasnya.
   Acuan: foto referensi — QR kanan-atas, foto kanan-tengah,
   data rata-kanan di kiri foto, label KARTU TANDA ANGGOTA
   kanan-bawah.
   ============================================================ */
.kta-front {
  background: #e9d826 url('../img/kta-template.png') center / cover no-repeat;
}
/* Template PNG sudah memuat teks "PARTAI GOLONGAN KARYA" persis seperti
   kartu fisik — overlay teks disembunyikan agar tidak ganda. */
.kta-front .kf-org,
.kta-front .kf-sub { display: none; }

/* ---------- chip QR kanan-atas (di samping ujung pita) ----------
   Acuan foto hasil akhir: QR ≈ 10cqw, kanan-atas, puncak ≈ 6,6cqw
   dari tepi atas, tepi kanan sejajar foto & blok data (≈ 96,5cqw). */
.kf-qr {
  position: absolute;
  right: 3.5cqw;
  top: 6.6cqw;
  width: 10cqw;
  height: 9.4cqw;
  background: #fff;
  border-radius: .8cqw;
  padding: .5cqw;
  box-shadow: 0 .4cqw 1.2cqw rgba(0, 0, 0, .28);
}
.kf-qr svg, .kf-qr img { width: 100%; height: 100%; display: block; }

/* ---------- nama organisasi di bawah lambang ----------
   Tinggi kartu = 63,2cqw (rasio 1291×816). Semua posisi vertikal
   dihitung agar tidak melebihi batas bawah kartu.
   Diberi halo putih tipis agar terbaca di atas background kuning. */
.kf-org {
  position: absolute;
  left: 4cqw;
  right: 4cqw;
  top: 19.4cqw; /* ≈ 31% tinggi kartu, tepat di bawah lambang */
  text-align: center;
  font-family: 'Sora', Arial, sans-serif;
  font-weight: 800;
  font-size: 3.05cqw;
  letter-spacing: .34cqw;
  color: #241c02;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 .2cqw 0 rgba(255,255,255,.55), 0 0 1.2cqw rgba(255,255,255,.6);
}
.kf-sub {
  position: absolute;
  left: 4cqw;
  right: 4cqw;
  top: 23.1cqw; /* ≈ 36,5% tinggi */
  text-align: center;
  font-weight: 700;
  font-size: 1.55cqw;
  letter-spacing: .62cqw;
  color: #6b5a10;
  text-transform: uppercase;
  text-shadow: 0 .15cqw 0 rgba(255,255,255,.55);
}
.kf-sub:empty { display: none; }

/* ---------- slot foto kanan, langsung di bawah QR ----------
   Referensi: foto tidak besar, hampir persegi, tepi kanan sejajar QR.
   Posisi tepat di bawah chip QR dengan celah kecil. */
.kf-photo {
  position: absolute;
  right: 3.5cqw;
  top: 17.4cqw; /* QR berakhir ≈ 16cqw → celah kecil ke foto */
  width: 14cqw;
  height: 14cqw;
  border-radius: .55cqw;
  overflow: hidden;
  background: linear-gradient(160deg, #fff8e0, #f3e3ae);
  box-shadow:
    0 .5cqw 1.3cqw rgba(0, 0, 0, .3),
    0 0 0 .3cqw rgba(255, 255, 255, .9);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kf-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.kf-ini {
  font-family: 'Sora', Arial, sans-serif;
  font-weight: 800;
  font-size: 5.6cqw;
  color: #8a6d1c;
  letter-spacing: .2cqw;
}

/* ---------- blok data rata kanan, DI BAWAH foto (seperti referensi) ----------
   Urutan: NAMA besar → NPAPG → Desa-Kecamatan → wilayah organisasi,
   tepi kanan sejajar foto & QR. */
.kf-data {
  position: absolute;
  right: 3.6cqw;
  top: 32.6cqw; /* foto berakhir di 31,4cqw → data mulai segera di bawahnya */
  text-align: right;
  max-width: 82cqw;
  text-shadow: 0 .2cqw 0 rgba(255,255,255,.5), 0 0 1cqw rgba(255,255,255,.55);
}
.kf-nama {
  font-family: 'Sora', Arial, sans-serif;
  font-weight: 800;
  font-size: 4.2cqw;
  letter-spacing: .12cqw;
  color: #191300;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}
.kf-npapg {
  font-family: 'Sora', Arial, sans-serif;
  font-weight: 700;
  font-size: 3.6cqw;
  color: #191300;
  margin-top: .45cqw;
  line-height: 1.2;
  letter-spacing: .02cqw;
  white-space: nowrap;
}
.kf-npapg .lbl {
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: .1cqw;
  color: inherit;
  margin-right: .8cqw;
}
.kf-wil {
  font-size: 3.05cqw;
  font-weight: 600;
  color: #191300;
  line-height: 1.35;
  margin-top: .55cqw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kf-wil2 {
  font-size: 3.05cqw;
  font-weight: 600;
  color: #191300;
  line-height: 1.35;
  margin-top: .5cqw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kf-exp {
  margin-top: .55cqw;
  font-size: 1.8cqw;
  font-weight: 700;
  color: #4c3d08;
  letter-spacing: .06cqw;
}
.kf-exp .lbl {
  font-weight: 800;
  font-size: 1.55cqw;
  letter-spacing: .4cqw;
  color: #6b5a10;
  margin-right: 1cqw;
}

/* ---------- label kanan-bawah: "KARTU TANDA ANGGOTA" ----------
   Rata kanan penuh — tepi kanan sejajar blok data/foto (3,6cqw). */
.kf-code {
  position: absolute;
  right: 3.6cqw;
  bottom: 2.3cqw;
  text-align: right;
}
.kf-code .rule {
  display: none;
}
.kf-code .val {
  font-family: 'Sora', Arial, sans-serif;
  font-weight: 800;
  font-size: 1.55cqw;
  letter-spacing: .16cqw;
  color: #241c02;
  text-transform: uppercase;
}
.kf-code .sub {
  margin-top: .35cqw;
  font-family: 'Sora', Arial, sans-serif;
  font-weight: 600;
  font-size: 1.35cqw;
  letter-spacing: .22cqw;
  color: rgba(36, 28, 2, .72);
}

/* ============================================================
   SISI BELAKANG — navy eksekutif + aksen emas (template .freebuff).
   Pita magnetik, QR verifikasi besar, identitas ringkas,
   segel hologram, penerbit di pita bawah.
   ============================================================ */
.kta-back {
  display: flex;
  flex-direction: column;
  color: #f4ecd6;
  background:
    radial-gradient(58cqw 40cqw at 88% -12%, rgba(232, 199, 102, .22), transparent 62%),
    radial-gradient(48cqw 34cqw at 6% 112%, rgba(84, 118, 214, .3), transparent 60%),
    linear-gradient(158deg, #0e1c39 0%, #16264c 46%, #1d2f6f 100%);
}
/* guilloche halus agar sulit dipalsukan */
.kta-back::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .05) 0 .22cqw, transparent .22cqw 3.4cqw),
    repeating-linear-gradient(65deg, rgba(232, 199, 102, .05) 0 .22cqw, transparent .22cqw 4.6cqw);
}

/* ---------- pita atas: judul + organisasi ---------- */
.kb-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  padding: 1.9cqw 3.4cqw 1.6cqw;
  font-family: 'Sora', Arial, sans-serif;
  text-transform: uppercase;
}
.kb-top .t {
  font-weight: 800;
  font-size: 2.1cqw;
  letter-spacing: .42cqw;
  color: #e8c766;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-top .o {
  font-weight: 700;
  font-size: 1.6cqw;
  letter-spacing: .24cqw;
  color: rgba(244, 236, 214, .85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-toprule {
  position: relative;
  height: .3cqw;
  margin: 0 3.4cqw;
  background: linear-gradient(90deg, #e8c766 0%, rgba(232, 199, 102, .12) 60%, transparent 100%);
}

/* ---------- pita magnetik ---------- */
.kb-mag {
  position: relative;
  height: 6.4cqw;
  margin-top: 2.4cqw;
  background: linear-gradient(180deg, #10131c, #23283a 55%, #10131c);
  box-shadow: inset 0 .3cqw .6cqw rgba(255, 255, 255, .08), inset 0 -.3cqw .6cqw rgba(0, 0, 0, .6);
}

/* ---------- badan kartu ---------- */
.kb-body {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3cqw;
  padding: 2.6cqw 3.4cqw 2.2cqw;
  min-height: 0;
}
.kb-qrwrap { flex-shrink: 0; text-align: center; }
.kb-qr {
  width: 21cqw;
  height: 21cqw;
  background: #fff;
  border-radius: 1.6cqw;
  padding: 1.2cqw;
  box-shadow: 0 .5cqw 1.6cqw rgba(0, 0, 0, .45), 0 0 0 .25cqw rgba(232, 199, 102, .55);
}
.kb-qr svg, .kb-qr img { width: 100%; height: 100%; display: block; }
.kb-qrhint {
  margin-top: 1.1cqw;
  font-size: 1.35cqw;
  font-weight: 600;
  letter-spacing: .18cqw;
  color: rgba(244, 236, 214, .66);
  text-transform: uppercase;
}

.kb-info { flex: 1; min-width: 0; }
.kb-nama {
  font-family: 'Sora', Arial, sans-serif;
  font-weight: 800;
  font-size: 4.6cqw;
  letter-spacing: .1cqw;
  color: #f7edd0;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-role {
  margin-top: .55cqw;
  font-size: 2.05cqw;
  font-weight: 600;
  color: rgba(244, 236, 214, .82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-chips { display: flex; flex-wrap: wrap; gap: 1.2cqw; margin-top: 1.7cqw; }
.kb-chip {
  background: rgba(232, 199, 102, .13);
  border: .22cqw solid rgba(232, 199, 102, .4);
  border-radius: 1.2cqw;
  padding: .8cqw 1.7cqw;
  font-family: 'Sora', Arial, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-chip .k {
  display: block;
  font-size: 1.25cqw;
  font-weight: 800;
  letter-spacing: .4cqw;
  color: #e8c766;
  text-transform: uppercase;
}
.kb-chip .v {
  display: block;
  margin-top: .3cqw;
  font-size: 1.95cqw;
  font-weight: 700;
  letter-spacing: .12cqw;
  color: #f4ecd6;
}
.kb-url {
  margin-top: 1.7cqw;
  font-family: 'Sora', Arial, sans-serif;
  font-size: 1.7cqw;
  font-weight: 600;
  letter-spacing: .1cqw;
  color: rgba(244, 236, 214, .75);
  word-break: break-all;
}

/* ---------- segel hologram + masa berlaku ---------- */
.kb-sealcol { flex-shrink: 0; text-align: center; }
.kb-seal {
  width: 12.6cqw;
  height: 12.6cqw;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2cqw;
  font-family: 'Sora', Arial, sans-serif;
  color: #f7edd0;
  background:
    conic-gradient(from 20deg, rgba(232,199,102,.85), rgba(244,236,214,.35) 25%, rgba(232,199,102,.7) 50%, rgba(244,236,214,.3) 75%, rgba(232,199,102,.85)),
    linear-gradient(#1a2c58, #1a2c58);
  background-blend-mode: overlay, normal;
  box-shadow: 0 .4cqw 1.6cqw rgba(0, 0, 0, .45), inset 0 0 0 .25cqw rgba(244, 236, 214, .5);
}
.kb-seal .s1 { font-size: 2.9cqw; font-weight: 800; letter-spacing: .18cqw; }
.kb-seal .s2 { font-size: 1.15cqw; font-weight: 700; letter-spacing: .3cqw; color: #e8c766; text-transform: uppercase; }
.kb-valid {
  margin-top: 1.2cqw;
  font-size: 1.35cqw;
  font-weight: 700;
  letter-spacing: .1cqw;
  color: rgba(244, 236, 214, .78);
  white-space: nowrap;
}
.kb-valid .k { color: #e8c766; letter-spacing: .3cqw; }

/* ---------- catatan + pita penerbit ---------- */
.kb-note {
  position: relative;
  padding: 0 3.4cqw 1.9cqw;
  font-size: 1.5cqw;
  font-weight: 500;
  line-height: 1.5;
  color: rgba(244, 236, 214, .62);
}
.kb-strip {
  position: relative;
  background: linear-gradient(90deg, #caa24a, #e8c766 30%, #f2df9f 55%, #d9b355 85%, #caa24a);
  color: #16264c;
  font-family: 'Sora', Arial, sans-serif;
  font-weight: 800;
  font-size: 1.7cqw;
  letter-spacing: .3cqw;
  text-transform: uppercase;
  text-align: center;
  padding: 1.35cqw 2cqw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- mode cetak master: sudut tajam ---------- */
.kta-print, .kta-print .kta-face { border-radius: 0; box-shadow: none; }
