/* Dasar bersama halaman tamu dan admin. Alasan tiap keputusan ada di docs/DESIGN.md. */

@font-face { font-family: 'Bodoni Moda'; font-style: normal; font-weight: 400; font-display: swap; src: url('../vendor/fonts/bodoni-moda-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bodoni Moda'; font-style: italic; font-weight: 400; font-display: swap; src: url('../vendor/fonts/bodoni-moda-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Bodoni Moda'; font-style: normal; font-weight: 700; font-display: swap; src: url('../vendor/fonts/bodoni-moda-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('../vendor/fonts/instrument-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('../vendor/fonts/instrument-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('../vendor/fonts/instrument-sans-latin-600-normal.woff2') format('woff2'); }

:root {
  --paper: #f6f4ef;
  --paper-2: #ece9e2;
  --ink: #151515;
  --ink-2: #3d3b37;
  --muted: #615e58;
  --hairline: #cfcac0;
  --danger: #a3201b;
  --scrim: rgba(21, 21, 21, 0.55);

  --serif: 'Bodoni Moda', 'Bodoni 72', Didot, Georgia, serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --gutter: 16px;
  --tap: 48px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #111110;
  --paper-2: #1c1b19;
  --ink: #eeebe4;
  --ink-2: #cfcbc2;
  --muted: #a39f96;
  --hairline: #3a3834;
  --danger: #ff8a80;
  --scrim: rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111110;
    --paper-2: #1c1b19;
    --ink: #eeebe4;
    --ink-2: #cfcbc2;
    --muted: #a39f96;
    --hairline: #3a3834;
    --danger: #ff8a80;
    --scrim: rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

@media (min-width: 600px) { :root { --gutter: 32px; } }
@media (min-width: 1024px) { :root { --gutter: 48px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img, video, canvas, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.on-dark :focus-visible { outline-color: #f2f0eb; }

.skip-link {
  position: absolute; left: var(--s2); top: -100px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: var(--s2) var(--s3);
}
.skip-link:focus { top: var(--s2); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.boot-note { padding: var(--s7) var(--gutter); color: var(--muted); }

/* ---- Tipografi ---- */
.serif { font-family: var(--serif); font-weight: 400; }
.dateline {
  font: 600 12.5px/1.4 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---- Tombol ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s5);
  border: 1.5px solid var(--ink); border-radius: 0;
  background: transparent; color: var(--ink);
  font: 600 15px/1.2 var(--sans); text-decoration: none; text-align: center;
  cursor: pointer; touch-action: manipulation;
  transition: background-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--ink-2); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 40px; padding: 0 var(--s4); font-size: 14px; }

.link-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s1);
  border: 0; background: none; cursor: pointer;
  font: 600 14px/1.2 var(--sans); color: inherit;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link-btn:hover { text-decoration-thickness: 2px; }

/* ---- Field ---- */
.field { display: grid; gap: var(--s1); }
.field-label { font: 600 14px/1.3 var(--sans); }
.field-hint { font-size: 13px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; min-height: var(--tap); padding: 10px var(--s3);
  border: 1.5px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink);
}
.textarea { min-height: 88px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.field-error { color: var(--danger); font-size: 14px; }

/* Switch: persegi, konsisten dengan sudut tajam di seluruh UI */
.switch { display: flex; align-items: flex-start; gap: var(--s3); cursor: pointer; min-height: var(--tap); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex: none; position: relative; width: 48px; height: 28px; margin-top: 2px;
  border: 1.5px solid currentColor; background: transparent;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px;
  background: currentColor; transition: transform 140ms ease;
}
.switch input:checked + .switch-track { background: currentColor; }
.switch input:checked + .switch-track::after { transform: translateX(20px); background: var(--switch-knob, var(--paper)); }
.switch input:focus-visible + .switch-track { outline: 2px solid currentColor; outline-offset: 3px; }
.switch input:disabled + .switch-track { opacity: 0.4; }
.switch-text { display: grid; gap: 2px; }
.switch-title { font-weight: 600; }

.checkline { display: flex; align-items: center; gap: var(--s3); min-height: 44px; cursor: pointer; }
.checkline input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }

/* ---- Dialog / sheet ---- */
dialog.sheet {
  width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; padding: 0;
  border: 0; border-top: 3px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink);
  overflow: auto;
}
dialog.sheet::backdrop { background: var(--scrim); }
@media (min-width: 600px) {
  dialog.sheet { margin: auto; max-width: 460px; border: 1.5px solid var(--ink); border-top-width: 3px; }
}
.sheet-body { display: grid; gap: var(--s4); padding: var(--s5) var(--gutter) calc(var(--s5) + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .sheet-body { padding: var(--s6); } }
.sheet-title { font: 400 30px/1.1 var(--serif); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: flex-end; }
.sheet-actions .btn { flex: 1 1 140px; }
.steps { display: grid; gap: var(--s2); padding-left: 1.4em; list-style: decimal; }

/* ---- Toast ---- */
.toast-region {
  position: fixed; left: 0; right: 0; bottom: calc(var(--s4) + env(safe-area-inset-bottom)); z-index: 90;
  display: grid; justify-items: center; gap: var(--s2); padding: 0 var(--gutter); pointer-events: none;
}
.toast {
  max-width: 480px; padding: var(--s3) var(--s4);
  background: var(--ink); color: var(--paper); font-weight: 500; font-size: 15px;
  pointer-events: auto;
}
.toast.is-error { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .toast.is-error { color: #1a0605; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast.is-error { color: #1a0605; } }

/* ---- State blocks ---- */
.state {
  display: grid; gap: var(--s3); justify-items: start;
  padding: var(--s6) 0; border-top: 1px solid var(--hairline);
}
.state-title { font: 400 26px/1.15 var(--serif); }
.state p { color: var(--ink-2); max-width: 46ch; }
.state.is-error .state-title { color: var(--danger); }

.progress { height: 4px; background: var(--hairline); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: currentColor; transition: width 160ms linear; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
