/* ---------- editor kartu nama digital ---------- */
/* Bahasa desain: permukaan lembut, garis rambut 1px, satu aksen.
   Tanpa bayangan keras / border 2px.
   --accent diisi editor.js dari warna aksen pilihan pengguna,
   --accent-ink otomatis gelap/terang supaya teks di atasnya tetap terbaca. */

:root {
  --accent: var(--lime);
  --accent-ink: var(--ink);
}

.ed__bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

/* brand: buang bayangan keras di konteks editor */
.ed__bar .brand__mark {
  border: 0;
  box-shadow: none;
  border-radius: 10px;
}

.ed__bar .brand__mark svg {
  width: 18px;
  height: 18px;
}

.ed__main {
  width: min(1120px, 100% - 2.5rem);
  margin: clamp(2rem, 5vw, 3rem) auto clamp(3rem, 8vw, 4.5rem);
}

.ed__head {
  max-width: 34rem;
  margin-bottom: clamp(1.6rem, 4vw, 2.4rem);
}

.ed__head h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.75rem, 4.2vw, 2.5rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.ed__head p {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.ed__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 330px);
  gap: clamp(1.75rem, 4vw, 3.25rem);
  align-items: start;
}

/* ---------- panel utama ---------- */

.ed__form {
  display: grid;
  gap: 1.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(1.35rem, 3vw, 2rem);
  box-shadow: 0 28px 60px -40px rgba(0, 0, 0, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

/* ---------- grup field ---------- */

.ed__group {
  display: grid;
  gap: 1.05rem;
}

.ed__group + .ed__group {
  border-top: 1px solid var(--line);
  padding-top: 1.9rem;
  margin-top: -0.55rem;
}

.ed__group-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text);
}

.ed__field {
  display: grid;
  gap: 0.5rem;
}

.ed__field > label,
.ed__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- input ---------- */

.ed__field input,
.ed__field textarea,
.ed__qrbox input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.78rem 0.9rem;
  transition: border-color 0.16s ease, background 0.16s ease,
    box-shadow 0.16s ease;
}

.ed__field input::placeholder,
.ed__field textarea::placeholder,
.ed__qrbox input::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.ed__field textarea {
  resize: vertical;
  line-height: 1.55;
  min-height: 4.4rem;
}

.ed__field input:hover,
.ed__field textarea:hover,
.ed__qrbox input:hover {
  border-color: color-mix(in srgb, var(--line-strong) 60%, var(--muted));
}

.ed__field input:focus-visible,
.ed__field textarea:focus-visible,
.ed__qrbox input:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* prefix @ dan /c/ */

.ed__pre {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding-left: 0.9rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.ed__pre:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.ed__pre span {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.ed__pre input {
  border: 0;
  background: transparent;
  padding-left: 0.5rem;
}

.ed__pre input:hover,
.ed__pre input:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* ---------- warna aksen ---------- */

.ed__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.ed__sw {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c);
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.16s var(--ease-out), box-shadow 0.16s ease;
}

.ed__sw:hover {
  transform: scale(1.08);
}

.ed__sw[aria-pressed="true"] {
  transform: scale(1.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 0 2px var(--bg),
    0 0 0 4px var(--accent);
}

.ed__custom {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.ed__custom input {
  width: 40px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-2);
  cursor: pointer;
}

.ed__custom input::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.ed__custom input::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}

.ed__custom input::-moz-color-swatch {
  border: 0;
  border-radius: 5px;
}

/* ---------- checkbox ---------- */

.ed__check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.2rem;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text);
  cursor: pointer;
}

.ed__check input {
  appearance: none;
  -webkit-appearance: none;
  width: 21px;
  height: 21px;
  min-width: 21px;
  flex: none;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 7px;
  background: var(--bg-2);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 13px;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.ed__check input:hover {
  border-color: var(--muted);
}

.ed__check input:checked {
  background-color: var(--lime);
  border-color: var(--lime);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b0910' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.6 4.6 4.6L19 7.4'/%3E%3C/svg%3E");
}

/* ---------- unggah foto ---------- */

.ed__field input.ed__file {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  padding: 0;
  margin: -1px;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.ed__up {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.ed__up:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 999px;
}

.ed__up-thumb {
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 14px;
  background: var(--bg-2) center/cover no-repeat;
  box-shadow: inset 0 0 0 1px var(--line-strong),
    0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.ed__up-thumb--av {
  border-radius: 50%;
}

.ed__up-thumb[hidden] {
  display: none;
}

.ed__up-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.66rem 1.05rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease,
    color 0.16s ease;
}

.ed__up-btn:hover {
  border-color: var(--accent);
  color: color-mix(in srgb, var(--accent) 68%, var(--text));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-2));
}

.ed__up-btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.ed__up-clear {
  margin-left: auto;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.ed__up-clear:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.ed__up-clear[hidden] {
  display: none;
}

/* ---------- link ---------- */

.ed__links {
  display: grid;
  gap: 0.6rem;
}

.ed__link {
  display: grid;
  grid-template-columns: 1fr 1.25fr auto;
  gap: 0.5rem;
  align-items: center;
}

.ed__link input {
  font-size: 0.86rem;
  padding: 0.68rem 0.75rem;
}

.ed__del {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.ed__del:hover {
  border-color: var(--coral);
  color: var(--coral);
}

/* ---------- tombol (khusus editor) ---------- */
/* editor.css dimuat setelah styles.css, jadi aturan ini menimpa gaya
   brutalis bawaan (bayangan keras + translate saat ditekan). */

.btn {
  border: 1px solid transparent;
  box-shadow: none;
  font-size: 0.92rem;
  padding: 0.85rem 1.4rem;
  translate: none;
  transition: background-color 0.16s ease, border-color 0.16s ease,
    color 0.16s ease, transform 0.16s var(--ease-out);
}

.btn--go {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn--go:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--accent-ink));
  border-color: color-mix(in srgb, var(--accent) 88%, var(--accent-ink));
}

.btn--ghost {
  background: var(--bg-2);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: var(--muted);
  background: var(--card-2);
  color: var(--text);
}

.btn--sm {
  padding: 0.62rem 1.1rem;
  font-size: 0.85rem;
}

.btn:active {
  translate: none;
  transform: translateY(1px) scale(0.99);
}

.btn--go:active,
.btn--ghost:active {
  box-shadow: none;
}

.ed__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  margin-top: -0.5rem;
}

.ed__actions #edCopy {
  grid-column: 1 / -1;
}

/* ---------- preview HP ---------- */

.ed__side {
  display: grid;
  gap: 0.9rem;
  position: sticky;
  top: 92px;
}

.ed__phone {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin-inline: auto;
  aspect-ratio: 9 / 19.5;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 42px;
  background: #050507;
  box-shadow: 0 40px 70px -45px rgba(0, 0, 0, 1),
    0 0 90px -30px color-mix(in srgb, var(--accent) 26%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  --ui: #fff;
  --scrim-top: rgba(0, 0, 0, 0.4);
  --scrim-bot: rgba(0, 0, 0, 0.32);
}

.ed__phone.is-light {
  --ui: #191919;
  --scrim-top: rgba(255, 255, 255, 0.55);
  --scrim-bot: rgba(255, 255, 255, 0.45);
}

.ed__phone::before,
.ed__phone::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 42px;
  pointer-events: none;
  z-index: 2;
}

.ed__phone::before {
  top: 6px;
  background: linear-gradient(180deg, var(--scrim-top), rgba(0, 0, 0, 0));
  border-top-left-radius: 36px;
  border-top-right-radius: 36px;
}

.ed__phone::after {
  bottom: 6px;
  background: linear-gradient(0deg, var(--scrim-bot), rgba(0, 0, 0, 0));
  border-bottom-left-radius: 36px;
  border-bottom-right-radius: 36px;
}

.ed__frame {
  display: block;
  position: absolute;
  top: 6px;
  left: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  border: 0;
  border-radius: 36px;
  background: var(--bg);
  pointer-events: none;
}

.ed__notch {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 38%;
  height: 19px;
  background: #050507;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 4;
}

.ed__status {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  height: 19px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ui);
  letter-spacing: 0.01em;
  pointer-events: none;
  z-index: 3;
}

.ed__status > b {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28%;
  text-align: center;
}

.ed__sys {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ed__sys svg {
  display: block;
  fill: currentColor;
}

.ed__home {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 34%;
  height: 5px;
  border-radius: 999px;
  background: var(--ui);
  opacity: 0.85;
  z-index: 3;
}

.ed__hint {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  max-width: 290px;
  margin-inline: auto;
}

.ed__hint.is-ok {
  color: color-mix(in srgb, var(--accent) 68%, var(--text));
}

/* ---------- tools (QR + terbitkan) ---------- */

.ed__tools {
  display: grid;
  gap: 1rem;
}

@media (min-width: 861px) {
  .ed__tools {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.ed__qrbox,
.ed__pub {
  display: grid;
  gap: 0.65rem;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.15rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.ed__qrhelp {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.ed__qr {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-top: 0.15rem;
}

.ed__qr-canvas {
  width: 86px;
  height: 86px;
  flex: none;
  padding: 5px;
  background: #fff;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.ed__slug span {
  color: var(--muted);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.ed__pubhint {
  color: var(--muted);
  font-size: 0.8rem;
}

.ed__pubhint.is-ok {
  color: var(--mint);
}

.ed__pubresult {
  display: grid;
  gap: 0.55rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.ed__pubresult[hidden] {
  display: none;
}

.ed__pubresult a#edPubLink {
  color: color-mix(in srgb, var(--accent) 68%, var(--text));
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  word-break: break-all;
  text-decoration: none;
}

.ed__pubrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- pemilih tema ---------- */

.ed__themes {
  display: grid;
  gap: 1.1rem;
}

.ed__cat {
  display: grid;
  gap: 0.6rem;
}

.ed__cat-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.ed__themegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
}

.ed__theme {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.45rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease,
    transform 0.16s var(--ease-out);
}

.ed__theme:hover {
  border-color: var(--muted);
  transform: translateY(-2px);
}

.ed__theme[aria-checked="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-2));
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ed__theme[aria-checked="true"] .ed__theme-name {
  color: var(--text);
}

.ed__theme:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.ed__theme-mini {
  width: 100%;
  height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 9px;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.25);
  overflow: hidden;
}

.ed__theme-av {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: none;
}

.ed__theme-bar {
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.85;
}

.ed__theme-bar--s {
  opacity: 0.42;
}

.ed__theme-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 6px;
}

.ed__theme-ln {
  height: 14px;
  border-radius: 4px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 20%, transparent);
  display: flex;
  align-items: center;
  padding: 0 3.5px;
}

.ed__theme-dot {
  width: 5px;
  height: 5px;
  border-radius: 2px;
  flex: none;
}

.ed__theme-name {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
  text-align: center;
}

/* ---------- footer ---------- */

.ed__foot {
  border-top: 1px solid var(--line);
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.ed__foot a {
  color: var(--lime);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- mobile ---------- */

@media (max-width: 860px) {
  .ed__main {
    width: min(1120px, 100% - 2rem);
  }

  .ed__grid {
    grid-template-columns: 1fr;
    gap: 1.35rem;
  }

  .ed__side {
    position: static;
    order: -1;
    gap: 0.7rem;
  }

  /* preview jadi kartu penuh (tanpa cropping) di HP */
  .ed__phone {
    max-width: none;
    width: 100%;
    aspect-ratio: auto;
    height: auto;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    background: var(--bg-2);
    box-shadow: none;
    overflow: hidden;
  }

  .ed__phone::before,
  .ed__phone::after,
  .ed__notch,
  .ed__status,
  .ed__home {
    display: none;
  }

  .ed__frame {
    position: static;
    width: 100%;
    height: 460px;
    border-radius: 0;
    background: transparent;
  }

  .ed__hint {
    max-width: none;
    font-size: 0.8rem;
  }

  .ed__head {
    margin-bottom: 1.4rem;
  }

  .ed__head h1 {
    font-size: clamp(1.55rem, 7vw, 1.95rem);
  }

  .ed__form {
    gap: 1.6rem;
    padding: 1.15rem;
    border-radius: 18px;
  }

  .ed__group + .ed__group {
    padding-top: 1.6rem;
  }

  .ed__themegrid {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 0.5rem;
  }

  .ed__theme-mini {
    height: 80px;
    padding: 8px 7px;
  }

  .ed__theme-name {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .ed__link {
    grid-template-columns: 1fr auto;
  }

  .ed__link .ed__url {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .ed__actions {
    grid-template-columns: 1fr;
  }
}

/* ---------- aksesibilitas gerak ---------- */

@media (prefers-reduced-motion: reduce) {
  .ed__theme,
  .ed__sw,
  .ed__up-btn,
  .ed__up-clear,
  .ed__del,
  .btn,
  .ed__field input,
  .ed__field textarea,
  .ed__pre,
  .ed__check input {
    transition: none;
  }

  .ed__theme:hover,
  .ed__sw:hover,
  .ed__sw[aria-pressed="true"] {
    transform: none;
  }
}