/* =========================================================
  ChemEquilibrium Lab - assets/css/base.css
  ---------------------------------------------------------
  Fondasi utama aplikasi:
  - CSS variables
  - reset browser
  - font modern
  - warna dasar
  - typography
  - button/input normalization
  - accessibility helper
  - motion preference
========================================================= */

/* =========================================================
  Design Tokens
========================================================= */

:root {
  /* Brand */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;

  --secondary: #9333ea;
  --secondary-dark: #7e22ce;
  --secondary-soft: #f3e8ff;

  --success: #16a34a;
  --success-dark: #15803d;
  --success-soft: #dcfce7;

  --warning: #f59e0b;
  --warning-dark: #d97706;
  --warning-soft: #fef3c7;

  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-soft: #fee2e2;

  --reactant: #2563eb;
  --product: #f97316;
  --equilibrium: #9333ea;

  /* Neutral */
  --color-white: #ffffff;
  --color-black: #000000;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --blue-50: #eff6ff;
  --cyan-50: #ecfeff;
  --orange-50: #fff7ed;
  --purple-50: #faf5ff;
  --amber-300: #fcd34d;
  --cyan-100: #cffafe;

  /* Text */
  --text-main: #0f172a;
  --text-soft: #334155;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Background */
  --body-bg: #f8fafc;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-solid: #ffffff;
  --surface-soft: rgba(248, 250, 252, 0.86);

  /* Border */
  --border-soft: rgba(15, 23, 42, 0.1);
  --border-medium: rgba(15, 23, 42, 0.16);
  --border-strong: rgba(15, 23, 42, 0.24);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #2563eb, #06b6d4);
  --gradient-secondary: linear-gradient(135deg, #9333ea, #ec4899);
  --gradient-success: linear-gradient(135deg, #16a34a, #22c55e);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #f97316);
  --gradient-danger: linear-gradient(135deg, #f97316, #dc2626);
  --gradient-equilibrium: linear-gradient(135deg, #2563eb, #9333ea, #f97316);

  --gradient-page:
    radial-gradient(circle at 8% 12%, rgba(34, 211, 238, 0.28), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(147, 51, 234, 0.2), transparent 34%),
    radial-gradient(circle at 70% 92%, rgba(249, 115, 22, 0.16), transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #ffffff 45%, #f8fafc 100%);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 22px 60px rgba(15, 23, 42, 0.16);
  --shadow-xl: 0 34px 90px rgba(15, 23, 42, 0.2);

  --shadow-glow-blue: 0 0 34px rgba(37, 99, 235, 0.22);
  --shadow-glow-purple: 0 0 34px rgba(147, 51, 234, 0.22);
  --shadow-glow-orange: 0 0 34px rgba(249, 115, 22, 0.22);

  /* Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 999px;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;

  /* Font size */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 4rem;

  /* Line height */
  --leading-tight: 1.12;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.72;

  /* Layout */
  --header-height: 82px;
  --app-max-width: 1440px;
  --workspace-gap: 1.25rem;

  /* Animation */
  --duration-fast: 160ms;
  --duration-normal: 260ms;
  --duration-slow: 520ms;
  --duration-long: 760ms;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-base: 1;
  --z-header: 50;
  --z-overlay: 80;
  --z-modal: 100;
  --z-drag: 120;
}

/* =========================================================
  Browser Reset
========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text-main);
  background: var(--gradient-page);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    "Noto Sans",
    sans-serif;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  overflow-x: hidden;
  accent-color: var(--primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-modal-open {
  overflow: hidden;
}

img,
svg,
canvas,
video {
  display: block;
  max-width: 100%;
}

canvas {
  user-select: none;
  touch-action: none;
}

svg {
  overflow: visible;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  background: none;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

input,
select,
textarea {
  color: var(--text-main);
}

::selection {
  color: var(--color-white);
  background: rgba(37, 99, 235, 0.82);
}

/* =========================================================
  Typography
========================================================= */

h1,
h2,
h3,
h4 {
  color: var(--text-main);
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: var(--leading-tight);
}

h1 {
  font-size: clamp(2.45rem, 6vw, 5.25rem);
}

h2 {
  font-size: clamp(1.75rem, 3.8vw, 3.5rem);
}

h3 {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

h4 {
  font-size: var(--text-base);
  letter-spacing: -0.02em;
}

p {
  color: var(--text-soft);
  line-height: var(--leading-relaxed);
}

strong {
  font-weight: 900;
}

small {
  font-size: var(--text-sm);
}

sub,
sup {
  line-height: 0;
}

/* =========================================================
  Focus & Accessibility
========================================================= */

:focus {
  outline: none;
}

:focus-visible {
  outline: 4px solid rgba(37, 99, 235, 0.26);
  outline-offset: 4px;
  border-radius: var(--radius-md);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  border: 0 !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
}

/* =========================================================
  Base Utility Classes
========================================================= */

.text-muted {
  color: var(--text-muted);
}

.text-soft {
  color: var(--text-soft);
}

.text-center {
  text-align: center;
}

.no-wrap {
  white-space: nowrap;
}

.full-width {
  width: 100%;
}

.visually-soft {
  opacity: 0.72;
}

.glass {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.value-bump {
  animation: valueBump var(--duration-normal) var(--ease-bounce);
}

@keyframes valueBump {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

/* =========================================================
  App Shell Base
========================================================= */

.app-shell {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

.screen {
  width: 100%;
}

.app-screen {
  min-height: calc(100vh - var(--header-height));
}

/* =========================================================
  Form Base
========================================================= */

input[type="range"] {
  width: 100%;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.12);
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid var(--color-white);
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: var(--shadow-sm), var(--shadow-glow-blue);
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid var(--color-white);
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: var(--shadow-sm), var(--shadow-glow-blue);
}

input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  border-radius: 0.3rem;
}

/* =========================================================
  Tables / Lists Base
========================================================= */

dl {
  display: grid;
  gap: var(--space-3);
}

dt {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 800;
}

dd {
  color: var(--text-main);
  font-weight: 950;
}

/* =========================================================
  Dialog Base
========================================================= */

dialog {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
}

/* =========================================================
  Scrollbar
========================================================= */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.45) rgba(15, 23, 42, 0.08);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.06);
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  background: rgba(37, 99, 235, 0.45);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 99, 235, 0.65);
  background-clip: padding-box;
}

/* =========================================================
  Responsive Base
========================================================= */

@media (max-width: 760px) {
  :root {
    --header-height: 76px;
    --workspace-gap: 0.875rem;
  }

  body {
    font-size: 0.95rem;
  }

  h1 {
    letter-spacing: -0.055em;
  }
}

@media (max-width: 520px) {
  :root {
    --space-8: 1.5rem;
    --space-10: 2rem;
    --space-12: 2.25rem;
    --space-16: 3rem;
  }
}

/* =========================================================
  Reduced Motion
========================================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}