/*
 * Dasar bersama situs publik + admin. Gaya mengikuti template Porto
 * (Phudu + Instrument Sans, krem/hitam/oranye, tema terang + gelap),
 * dengan warna yang disesuaikan supaya lolos WCAG AA. Alasan di DESIGN.md.
 */
@font-face {
  font-family: "Phudu";
  src: url("../fonts/phudu-var.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  /* Tema terang (bawaan, sama seperti Porto) */
  --bg: #F5F1EA;
  --bg-2: #EDE9E0;
  --bg-3: #E3DED3;
  --card: #FDFAF5;
  --line: #D8D3C8;          /* garis pemisah dekoratif */
  --line-strong: #7A7468;   /* batas kontrol: 3.46:1 */
  --text: #0D0D0F;          /* 14.47:1 */
  --muted: #4A4A55;         /* teks paragraf sekunder: 6.52:1 */
  --faint: #5F5F6C;         /* label kecil: 4.69:1 (Porto #9A9AA8 = 2.47:1) */
  --accent: #FF4D1C;        /* oranye Porto untuk latar & garis */
  --accent-rgb: 255, 77, 28;
  --accent-text: #B02F08;   /* oranye untuk teks kecil: 4.64:1 */
  --accent-display: #E5410F;/* oranye untuk judul besar: min 3.07:1 (Porto #FF4D1C = 2.74:1) */
  --on-accent: #0D0D0F;     /* teks di atas oranye: 5.85:1 (putih = 3.32:1) */
  --navy: #1A1A2E;
  --ok: #12652F;
  --err: #B3261E;
  --nav-bg: rgba(245, 241, 234, .94);
  --shadow-1: 0 2px 20px rgba(0, 0, 0, .06);
  --shadow-2: 0 8px 40px rgba(0, 0, 0, .10);
  --shadow-3: 0 24px 80px rgba(0, 0, 0, .14);

  --font-display: "Phudu", "Arial Narrow", sans-serif;
  --font: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --r: 20px;
  --r-sm: 10px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --gutter: clamp(1.25rem, 3vw, 2.25rem);

  /* Ukuran teks Porto */
  --fs-hero: clamp(3.4rem, 8vw, 7.5rem);
  --fs-title: clamp(2.3rem, 4.5vw, 3.7rem);
  --fs-big: clamp(2.6rem, 6vw, 5.2rem);
  --fs-role: clamp(1.05rem, 2.2vw, 1.65rem);
  --fs-body: .95rem;
  --fs-desc: .97rem;
  --fs-small: .82rem;
  --fs-label: .72rem;
  /* Skala lama untuk CSS admin, disetel ke ukuran Porto */
  --step--1: .8rem; --step-0: .95rem; --step-1: 1.2rem; --step-2: 1.6rem;
  --step-3: clamp(2rem, 3.5vw, 2.8rem); --step-4: var(--fs-title); --step-5: var(--fs-hero);
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem;
  --s-6: 2rem; --s-7: 3rem; --s-8: 5rem; --s-9: 7.5rem;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #080810;
  --bg-2: #0F0F1A;
  --bg-3: #161625;
  --card: #12121F;
  --line: #1E1E30;
  --line-strong: #6C6C88;   /* 3.52:1 */
  --text: #F0EDE8;          /* 15.30:1 */
  --muted: #A5A2A0;         /* 7.04:1 */
  --faint: #8A8A9C;         /* 5.27:1 */
  --accent-text: #FF6A3D;   /* 5.78:1 */
  --accent-display: #FF4D1C;/* 6.01:1 */
  --navy: #070714;
  --ok: #4ADE80;
  --err: #FF8A70;
  --nav-bg: rgba(8, 8, 16, .94);
  --shadow-1: 0 2px 20px rgba(0, 0, 0, .3);
  --shadow-2: 0 8px 40px rgba(0, 0, 0, .45);
  --shadow-3: 0 24px 80px rgba(0, 0, 0, .65);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s, color .4s;
}
img, video, iframe, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); line-height: 1.1; font-weight: 700; color: var(--text); text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { width: 1em; height: 1em; display: inline-block; flex: none; vertical-align: -.125em; }

/* R-39: affordance kursor di satu tempat (kursor asli tidak disembunyikan) */
a[href], button:not(:disabled), summary, select:not(:disabled), label[for],
input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled), [role="button"] { cursor: pointer; }
button:disabled, select:disabled, input:disabled, textarea:disabled, [aria-disabled="true"] { cursor: not-allowed; }

/* R-32: fokus keyboard selalu terlihat */
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 10000;
  background: var(--text); color: var(--bg); padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); font-weight: 600;
}
.skip-link:focus { top: var(--s-4); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Tombol (pil, gaya Porto) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 28px;
  border: 2px solid var(--line); border-radius: 100px;
  background: transparent; color: var(--text);
  font-weight: 600; font-size: .86rem; line-height: 1.2; text-decoration: none; font-family: var(--font);
  transition: background-color .3s, color .3s, border-color .3s, transform .3s var(--ease-out), box-shadow .3s;
}
.btn:hover { border-color: var(--text); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; transform: none; }
/* Tombol utama: hitam, berubah oranye + glow saat hover (satu-satunya tombol ber-glow) */
.btn--primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: translateY(-3px); box-shadow: 0 14px 38px rgba(var(--accent-rgb), .35); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--accent:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn--sm { min-height: 44px; padding: 0 18px; font-size: .8rem; }
.btn--danger { border-color: var(--err); color: var(--err); }
.btn--danger:hover { background: var(--err); border-color: var(--err); color: var(--bg); }
.btn .ico { transition: transform .3s var(--ease-out); }
.btn:hover .ico { transform: translateX(3px); }

/* Label section: pil oranye muda, huruf normal, tanpa titik */
.stag {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 13px;
  padding: 5px 13px; border-radius: 100px;
  background: rgba(var(--accent-rgb), .12); color: var(--accent-text);
  font-size: var(--fs-label); font-weight: 600; letter-spacing: .02em;
}

/* ---------- Form ---------- */
.field { display: grid; gap: 7px; }
.field label, .label { font-weight: 600; font-size: .78rem; color: var(--text); }
.field .hint, .hint { color: var(--faint); font-size: .78rem; margin: 0; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  background: var(--bg-2); color: var(--text);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: .9rem; transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); opacity: 1; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--text); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .25); }
.field [aria-invalid="true"] { border-color: var(--err); border-width: 2px; }
.field-error { color: var(--err); font-size: .8rem; margin: 0; display: flex; gap: var(--s-2); font-weight: 600; }
.field-error::before { content: "!"; font-weight: 800; }
.check { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; font-size: .88rem; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.notice { padding: var(--s-4) var(--s-5); border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--card); }
.notice--ok { border-color: var(--ok); }
.notice--ok strong { color: var(--ok); }
.notice--err { border-color: var(--err); }
.notice--err strong { color: var(--err); }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice ul { padding-left: 1.2em; }

/* Bingkai gambar + placeholder jujur */
.frame { position: relative; background: var(--bg-3); overflow: hidden; border-radius: var(--r); }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame-ph {
  position: absolute; inset: 0; display: grid; place-content: center; gap: var(--s-1);
  text-align: center; color: var(--faint); font-size: .8rem; padding: var(--s-4);
}
.frame-ph strong { color: var(--text); font-size: .9rem; letter-spacing: .02em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
