/* Nunito (variable) disajikan lokal dari asset/fonts/Nunito.woff2; tampilan sama dengan desain register.html. */
@font-face {
  font-family: "Nunito";
  src: url("../../asset/fonts/Nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --sun: #FED449;            /* kuning utama (satu-satunya kuning merek) */
  --btn: var(--sun);          /* kuning tombol = kuning utama #FED449 */
  --btn-edge: #E6B72B;       /* garis tepi tombol (turunan lebih gelap) */
  --btn-press: #F2C73E;
  --link: #D9A400;
  --ink: #1A1A1A;
  --ink-soft: #5C5750;
  --line: #CAC6BD;           /* garis tepi field */
  --line-strong: #C1BCB2;    /* garis tepi tombol Google */
  --field-bg: #FFFEFB;
  --danger: #D6342B;
  --success: #2E7D4F;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }

/* Ukuran form: SAMA di login dan register */
:root {
  --h: clamp(44px, 7dvh, 56px);                     /* tinggi field & tombol */
  --gap: clamp(8px, 1.7dvh, 14px);                  /* jarak antar elemen */
  --card-w: clamp(320px, 54dvh, 440px);             /* lebar form */
}

body {
  display: grid;
  grid-template-columns: 1fr 1fr;                   /* kiri: ilustrasi, kanan: form */
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Sisi kiri: ilustrasi (isinya diatur per halaman) ---------- */
.art { position: sticky; top: 0; align-self: start; height: 100dvh; overflow: hidden; }

/* ---------- Sisi kanan: form. Logo selalu di posisi yang sama di tiap halaman ---------- */
.main {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(24px, 13dvh, calc(50dvh - 292px)) 24px 32px;   /* di layar besar: blok register berada di tengah */
}
.card { width: min(100%, var(--card-w)); }

.brand {
  width: calc(var(--card-w) * .6);
  margin-bottom: clamp(14px, 3.4dvh, 30px);
  aspect-ratio: 2048 / 720;          /* memotong ruang putih di sekitar logo */
  position: relative;
  overflow: hidden;
  margin-left: auto;
  margin-right: auto;
}
.brand img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 52%;
  display: block;
}

/* minmax(0,1fr): isi tidak boleh melebihi lebar kartu */
form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }

/* ---------- Field ---------- */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; min-width: 0; }

.control {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--h);
  padding: 0 18px;
  gap: 12px;
  min-width: 0;
  background: var(--field-bg);
  border: 2px solid var(--line);
  border-radius: 999px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.control:focus-within {
  border-color: var(--btn-edge);
  box-shadow: 0 0 0 4px rgba(254, 212, 73, .40);
}
.field.has-error .control { border-color: var(--danger); }
.field.has-error .control:focus-within { box-shadow: 0 0 0 4px rgba(214, 52, 43, .18); }

.control > svg { flex: none; width: 24px; height: 24px; color: #444; }

.control input {
  flex: 1 1 auto;
  width: 0;                    /* ukuran bawaan input tidak ikut melebarkan form */
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: 600 15px/1 var(--font);
  color: var(--ink);
}
.control input::placeholder { color: var(--ink-soft); font-weight: 600; opacity: 1; }

.toggle {
  flex: none;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  margin-right: -8px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: #444;
  cursor: pointer;
}
.toggle:hover { background: rgba(0, 0, 0, .06); }
.toggle:focus-visible { outline: 3px solid var(--btn-edge); outline-offset: 1px; }
.toggle svg { width: 22px; height: 22px; }
.toggle .eye-on { display: none; }
.toggle[aria-pressed="true"] .eye-on { display: block; }
.toggle[aria-pressed="true"] .eye-off { display: none; }

.error-msg {
  margin: 0 18px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--danger);
}
.error-msg:empty { display: none; }

/* ---------- Tombol (datar, seperti di desain) ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%;
  height: var(--h);
  border-radius: 999px;
  font-family: var(--font);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn:disabled { cursor: progress; }

.btn-primary {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .1px;
  color: var(--ink);
  background: var(--btn);
  border: 1.5px solid var(--btn-edge);
}
.btn-primary:hover { background: #FFDC6E; }
.btn-primary:active:not(:disabled) { background: var(--btn-press); transform: scale(.99); }
.btn-primary:disabled { background: #FFE590; border-color: #F0CF6E; }

.btn-google {
  font-size: 15px;
  font-weight: 800;
  color: #14142B;
  background: var(--field-bg);
  border: 2px solid var(--line-strong);
}
.btn-google:hover { background: #fff; border-color: #A8A296; }
.btn-google:active { transform: scale(.99); }
.btn-google svg { width: 22px; height: 22px; flex: none; }

.spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(27, 27, 27, .25);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Pemisah "atau" ---------- */
.divider {
  display: flex; align-items: center; gap: 14px;
  margin: var(--divider-m, -2px) 0;
  font-size: 13.5px;
  line-height: 1;
  font-weight: 400;
  color: var(--ink-soft);
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
}

/* ---------- Tautan bawah ---------- */
.links {
  display: flex; align-items: baseline;
  flex-wrap: wrap; gap: 4px 12px;
  margin: 2px 0 0;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink-soft);
}
.link {
  padding: 0;
  border: 0;
  background: none;
  font: 700 13.5px var(--font);
  color: var(--link);
  cursor: pointer;
  text-decoration: none;
}
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link:focus-visible { outline: 3px solid var(--btn-edge); outline-offset: 2px; border-radius: 4px; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 50;
  display: grid; gap: 10px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  border-left: 6px solid var(--btn);
  animation: toast-in .25s ease both;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: #2FB170; }
.toast.out { animation: toast-out .2s ease both; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Sisi kiri: lingkaran kuning dibuat dengan CSS ---------- */
.art::before {
  content: "";
  position: absolute;
  width: 101.4dvh;
  height: 101.4dvh;
  left: calc(8.9dvh - 50.7dvh);      /* pusat lingkaran sedikit masuk dari tepi kiri */
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--sun);
}
.art img {
  position: absolute;
  left: min(50.7dvh, 28.5vw);
  top: 50%;
  width: min(50dvh, 40vw);
  height: auto;
  transform: translate(-50%, -50%);
  user-select: none;
  -webkit-user-drag: none;
}
.links { justify-content: center; }

/* ---------- Syarat kata sandi ---------- */
.rules {
  display: grid; gap: 2px;
  margin: -2px 18px 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  font-weight: 700;
}
.rules[hidden] { display: none; }
.rules li { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.rules li::before { content: "•"; width: 14px; text-align: center; font-weight: 900; }
.rules li.ok { color: var(--success); }
.rules li.ok::before { content: "✓"; }
.rules li.no { color: var(--danger); }
.rules li.no::before { content: "✕"; }

/* ---------- Mobile / portrait: kuning melengkung di atas, maskot menimpa bagian bawahnya ---------- */
@media (max-width: 860px), (orientation: portrait) {
  :root {
  --h: clamp(38px, min(10.8vw, 6.2dvh), 52px);      /* tinggi field & tombol */
  --gap: clamp(6px, min(2.6vw, 1.6dvh), 12px);      /* jarak antar elemen */
  --card-w: min(80vw, 440px);                       /* lebar form = 80% layar */
  }

  body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;            /* cadangan untuk layar sangat pendek */
  }
  .main {
    flex: 0 0 auto;
    display: block;
    padding: 0 0 calc(clamp(10px, 2dvh, 24px) + env(safe-area-inset-bottom, 0px));
  }
  .card { margin: 0 auto; }
  .art {
    --A: min(57vw, 31dvh, 340px);   /* tinggi area atas; sama di kedua halaman */
    position: relative;
    top: auto;
    align-self: auto;
    flex: 0 0 auto;
    width: 100%;
    height: var(--A);
  }
  .brand {
    width: min(46vw, 21dvh, 240px);
    min-width: 120px;
    margin-top: clamp(4px, 1.2dvh, 12px);
    margin-bottom: clamp(8px, min(4.7vw, 2.8dvh), 20px);
  }
  .control input { font-size: 16px; }   /* >=16px agar iOS tidak zoom saat fokus */
  .links, .link { font-size: 12.5px; }
  .links { gap: 4px 8px; }

  /* bentuk kuning: setengah elips menggantung dari atas selebar layar */
  .art::before {
    left: 0;
    top: 0;
    width: 100%;
    height: calc(var(--A) * .831);
    transform: none;
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
  }
  .art img { left: 50%; top: calc(var(--A) * .212); width: calc(var(--A) * .788); transform: translateX(-50%); }
  .links { justify-content: center; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .spinner { animation: spin 1.5s linear infinite !important; }
}