/* ── Twibbon maker ────────────────────────────────────────────────────────
   Theme tokens, header and buttons all come from /styles.css; this file only
   describes the parts unique to this page. Cropper.js supplies the drag/zoom
   chrome, so there is nothing here that reimplements it. */

.t-page {
  background: var(--c-wash);
}

.l-twib {
  padding: 3.5rem 1.5rem 5rem;
}

.l-twib__inner {
  max-width: 1040px;
  margin: 0 auto;
  text-align: center;
}

.l-twib__title {
  font-size: 2rem;
  color: var(--c-pink);
  margin-bottom: 0.9rem;
}

.l-twib__text {
  color: var(--c-body);
  max-width: 560px;
  margin: 0 auto 2.75rem;
}

.l-twib__back {
  margin-top: 2.5rem;
  font-size: 0.88rem;
}

.l-twib__back a {
  color: var(--c-pink);
  font-weight: 700;
}

.c-twib {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
  text-align: left;
}

.c-twib__stage {
  flex: 1 1 520px;
  min-width: 0;
}

/* The stage the crop box, the frame overlay and the exported PNG all share.
   Its ratio comes from whichever frame is chosen, so they stay in register. */
.c-twib__canvas {
  position: relative;
  width: 100%;
  /* Placeholder shape only: selectFrame() overwrites this inline with the
     chosen frame's real ratio, so a portrait frame gets a portrait stage. */
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.12);
}

/* Cropper measures the element it replaces, so the bare img must not be
   allowed to lay out at its natural size before then. */
.c-twib__img {
  display: block;
  max-width: 100%;
  opacity: 0;
}

.c-twib__canvas.is-ready .c-twib__img {
  opacity: 1;
}

.c-twib__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

/* Armed only once a frame is chosen: the whole stage then acts as the photo
   upload button, matching "Pilih Foto". */
.c-twib__empty.is-clickable {
  cursor: pointer;
}

.c-twib__empty.is-clickable:hover .c-twib__empty-copy,
.c-twib__empty.is-clickable:focus-visible .c-twib__empty-copy {
  transform: scale(1.05);
}

.c-twib__empty.is-clickable:focus-visible {
  outline: 3px solid var(--c-pink);
  outline-offset: -3px;
}

.c-twib__empty-copy {
  transition: transform 0.25s ease;
}

.c-twib__empty-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.45;
}

.c-twib__empty-copy {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  color: var(--c-pink);
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  padding: 0 2rem;
}

/* Live preview: the frame sits on top of the crop box so what you drag is
   what you download. It must never eat the pointer, or dragging dies. */
.c-twib__overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.c-twib__panel {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  background: #ffffff;
  border: 1px solid var(--c-border);
  border-radius: 18px;
  padding: 1.75rem 1.5rem;
}

.c-twib__block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
}

.c-twib__label {
  font-size: 0.9rem;
  color: var(--c-pink);
  margin: 0;
}

.c-twib__hint {
  font-size: 0.8rem;
  color: var(--c-muted);
  line-height: 1.55;
}

.c-twib__frames {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.c-twib__frame {
  width: 68px;
  height: 68px;
  padding: 0;
  border: 2px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-wash);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.c-twib__frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.c-twib__frame:hover {
  transform: translateY(-2px);
}

.c-twib__frame[aria-checked="true"] {
  border-color: var(--c-pink);
}

/* Marks the visitor's own upload apart from the ready-made frames. */
.c-twib__frame.is-custom {
  border-style: dashed;
}

.c-twib__add {
  display: grid;
  place-items: center;
  border-style: dashed;
  color: var(--c-pink);
}

.c-twib__add:hover:not([disabled]) {
  border-color: var(--c-pink);
  background: #ffffff;
}

.c-twib__add[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.c-twib__add[disabled]:hover {
  transform: none;
}

.c-twib__frame:focus-visible {
  outline: 3px solid var(--c-pink);
  outline-offset: 2px;
}

/* The button carries all the interaction; the input is only the file picker
   it opens, so it is taken out of the layout and the tab order entirely. */
.c-twib__file {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.c-twib__file-input {
  display: none;
}

.c-twib__file:focus-visible .c-btn__link {
  outline: 3px solid var(--c-pink);
  outline-offset: 3px;
}

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

.c-twib__tool {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--c-pink);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.c-twib__tool:hover {
  background: var(--c-wash);
  transform: translateY(-2px);
}

.c-twib__tool:focus-visible {
  outline: 3px solid var(--c-pink);
  outline-offset: 2px;
}

.c-twib__download {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  width: 100%;
}

.c-twib__download[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.c-twib__download[disabled] .c-btn__link::before {
  width: 0;
}

.c-twib__status {
  font-size: 0.8rem;
  color: var(--c-muted);
  min-height: 1.1em;
}

.c-twib__req {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--c-pink);
  color: #ffffff;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.c-twib__hint.is-error {
  color: var(--c-pink);
  font-weight: 700;
}

.c-twib__status.is-error {
  color: var(--c-pink);
  font-weight: 700;
}

/* Cropper's own chrome, toned down to the site's palette. */
.cropper-view-box {
  outline: 0;
}

.cropper-line,
.cropper-point {
  display: none;
}

.cropper-modal {
  background: #ffffff;
  opacity: 0.55;
}

@media (max-width: 900px) {
  .c-twib {
    flex-direction: column;
    gap: 1.75rem;
  }

  .c-twib__stage,
  .c-twib__panel {
    flex: 1 1 auto;
    width: 100%;
  }

  .l-twib__title {
    font-size: 1.55rem;
  }
}

/* ── Per-frame copy buttons ───────────────────────────────────────────────
   Populated from the admin panel and hidden until a frame that has them is
   picked, so the block only ever appears when it has something to offer. */
.c-twib__copies {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.c-twib__copy {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--c-body);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.c-twib__copy:hover {
  border-color: var(--c-pink);
  transform: translateY(-2px);
}

.c-twib__copy:focus-visible {
  outline: 3px solid var(--c-pink);
  outline-offset: 2px;
}

.c-twib__copy.is-copied {
  border-color: var(--c-pink);
  background: var(--c-wash);
  color: var(--c-pink);
}

.c-twib__copy-logo {
  display: inline-flex;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--c-pink);
}

.c-twib__copy-logo img,
.c-twib__copy-logo svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.c-twib__copy-label {
  /* A flex item will not wrap until its automatic minimum is lifted, so a long
     caption label would otherwise push the button wider instead of breaking. */
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
