/**
 * base.css — Litapdimas Design System v2
 * ========================================
 * Reset minimal, tipografi, focus-visible, reduced-motion.
 * Di-load setelah variables.css dan bootstrap-bridge.css.
 */

/* ============================================================
   1. Reset Minimal & Box Sizing
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
}

body {
  margin: 0;
  font-family: var(--font-sans, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: var(--text-body, 1rem);
  line-height: var(--leading-relaxed, 1.65);
  color: var(--text-primary, #334155);
  background-color: var(--surface-page, #f4f7f5);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   2. Tipografi — Skala Fluid
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3, 0.75rem);
  font-weight: 700;
  line-height: var(--leading-tight, 1.2);
  color: var(--text-strong, #0f172a);
}

h1 { font-size: var(--text-h1, clamp(1.75rem, 1.45rem + 1.2vw, 2.25rem)); }
h2 { font-size: var(--text-h2, clamp(1.375rem, 1.25rem + 0.5vw, 1.75rem)); }
h3 { font-size: var(--text-h3, clamp(1.125rem, 1.05rem + 0.3vw, 1.375rem)); }
h4 { font-size: var(--text-h4, 1.0625rem); }
h5 { font-size: var(--text-sm, 0.875rem); font-weight: 600; }
h6 { font-size: var(--text-xs, 0.75rem); font-weight: 600; }

p {
  margin: 0 0 var(--space-4, 1rem);
  max-width: 68ch;
}

a {
  color: var(--link-color, var(--brand-700, #006837));
  text-decoration: none;
  transition: color var(--motion-fast, 120ms) ease-out;
}

a:hover {
  color: var(--brand-800, #004d29);
  text-decoration: underline;
}

/* Angka tabular untuk skor, dana, tanggal */
.tabular-nums,
.ui-score__value,
.ui-stat__value,
.ui-row-date,
.ui-list-footer__info {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-sans, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
}

/* Eyebrow / label kecil */
.ui-eyebrow {
  margin: 0 0 var(--space-1, 0.25rem);
  color: var(--text-secondary, #475569);
  font-size: var(--text-xs, 0.75rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* Prose container */
.ui-prose {
  max-width: 68ch;
  line-height: 1.7;
}

.ui-prose p { margin-bottom: var(--space-3, 0.75rem); }
.ui-prose ul, .ui-prose ol { margin: 0 0 var(--space-3, 0.75rem) var(--space-4, 1rem); }
.ui-prose li { margin-bottom: var(--space-1, 0.25rem); }
.ui-prose strong { font-weight: 600; }
.ui-prose code {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.9em;
  padding: 0.125em 0.375em;
  background: var(--surface-sunken, #f8fafc);
  border-radius: var(--radius-xs, 6px);
}

/* ============================================================
   3. Focus Visible — Aksesibilitas Keyboard (R-32, R-39)
   ============================================================ */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--brand-700, #006837);
  outline-offset: 2px;
}

/* Fokus ring custom untuk komponen yang butuh ring di dalam container */
.ui-focus-ring:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring, 0 0 0 2px var(--surface-card, #ffffff), 0 0 0 4px var(--brand-700, #006837));
}

/* ============================================================
   4. Reduced Motion — R-19, R-39
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   5. Interaktif — Cursor & Disabled States (R-39)
   ============================================================ */
a[href],
button:not(:disabled),
input:not(:disabled),
select:not(:disabled),
textarea:not(:disabled),
summary,
[role="button"]:not([aria-disabled="true"]),
[role="tab"]:not([aria-disabled="true"]),
[role="switch"]:not([aria-disabled="true"]),
[role="menuitem"]:not([aria-disabled="true"]),
.ui-btn:not(:disabled),
.ui-icon-btn:not(:disabled),
.ui-chip:not([aria-disabled="true"]) {
  cursor: pointer;
}

:disabled,
[aria-disabled="true"],
.ui-btn:disabled,
.ui-icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ============================================================
   6. Form Dasar — Input, Select, Textarea
   ============================================================ */
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary, #334155);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted, #64748b);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-700, #006837);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 104, 55, 0.18);
}

[data-bs-theme="dark"] input:focus,
[data-bs-theme="dark"] select:focus,
[data-bs-theme="dark"] textarea:focus {
  border-color: var(--brand-600, #4ade80);
  box-shadow: 0 0 0 3px rgba(125, 211, 168, 0.25);
}

/* ============================================================
   6b. Theme Switch Transition & Toggle Button
   ============================================================ */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color var(--motion-theme, 280ms) var(--motion-theme-easing, cubic-bezier(0.4, 0, 0.2, 1)),
    color var(--motion-theme, 280ms) var(--motion-theme-easing, cubic-bezier(0.4, 0, 0.2, 1)),
    border-color var(--motion-theme, 280ms) var(--motion-theme-easing, cubic-bezier(0.4, 0, 0.2, 1)),
    box-shadow var(--motion-theme, 280ms) var(--motion-theme-easing, cubic-bezier(0.4, 0, 0.2, 1)),
    fill var(--motion-theme, 280ms) var(--motion-theme-easing, cubic-bezier(0.4, 0, 0.2, 1)),
    stroke var(--motion-theme, 280ms) var(--motion-theme-easing, cubic-bezier(0.4, 0, 0.2, 1)) !important;
  transition-delay: 0ms !important;
}

.ui-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm, 8px);
  transition: background-color var(--motion-fast, 120ms) ease-out,
              color var(--motion-fast, 120ms) ease-out,
              transform var(--motion-fast, 120ms) ease-out;
}

.ui-theme-toggle:hover {
  background-color: var(--surface-hover, #f1f5f9) !important;
  color: var(--brand-700, #006837) !important;
}

.ui-theme-toggle:active {
  transform: scale(0.94);
}

.ui-theme-toggle [data-theme-icon] {
  display: inline-flex;
  line-height: 1;
}

[data-bs-theme="dark"] .ui-theme-toggle:hover {
  background-color: var(--surface-hover, #16233a) !important;
  color: var(--brand-600, #4ade80) !important;
}

/* ============================================================
   7. Utility — Visually Hidden (Screen Reader Only)
   ============================================================ */
.ui-visually-hidden,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ============================================================
   8. Print Styles
   ============================================================ */
@media print {
  .no-print,
  .ui-btn,
  .ui-icon-btn,
  .ui-toolbar,
  .ui-tabs,
  .ui-decision-bar,
  .sticky-action-bar {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .page-proposal-detail,
  .proposal-list-page {
    max-width: none;
    padding: 0;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}