/* ============================================================
   UcuzScript Design System
   Warm daylight · Editorial commerce · Restrained luxury
   ============================================================ */

:root {
  /* Surfaces */
  --bg: #FAF9F6;
  --bg-warm: #F5F2EB;
  --surface: #FFFFFF;
  --surface-muted: #F7F5F0;

  /* Text */
  --ink: #242521;
  --ink-soft: #5C5B55;
  --ink-muted: #8A887F;
  --ink-faint: #B0AEA4;

  /* Borders */
  --line: #EAE8E2;
  --line-strong: #D8D5CC;

  /* Accent — muted olive */
  --accent: #4F5D3A;
  --accent-hover: #3F4A2E;
  --accent-soft: #E8EBE2;
  --accent-mid: #6B7A52;

  /* Sand */
  --sand: #D4C8B0;
  --sand-soft: #EFE9DC;

  /* Feedback */
  --success: #3D5A3A;
  --error: #8B3A2F;
  --warning: #8A6B2F;
  --danger-soft: #F8EDEB;
  --danger-line: #E8D0CB;

  /* On accent / chrome */
  --on-accent: #fff;
  --footer-bg: #242521;
  --toast-bg: #242521;
  --toast-fg: #F5F2EB;

  /* Type */
  --font-display: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;

  /* Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.75rem;
  --text-4xl: 3.5rem;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  /* Layout */
  --container: 1180px;
  --container-wide: 1320px;
  --header-h: 72px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 220ms;
  --duration-slow: 420ms;

  /* Shadows — barely there */
  --shadow-sm: 0 1px 2px rgba(36, 37, 33, 0.04);
  --shadow-md: 0 8px 24px rgba(36, 37, 33, 0.06);
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg: #161714;
  --bg-warm: #1C1B17;
  --surface: #22211C;
  --surface-muted: #2A2924;
  --ink: #F3F1EA;
  --ink-soft: #C8C4B8;
  --ink-muted: #938F84;
  --ink-faint: #6E6B63;
  --line: #34322C;
  --line-strong: #4A473F;
  --accent: #C5D2AE;
  --accent-hover: #D7E1C6;
  --accent-soft: #2C3326;
  --accent-mid: #A9B992;
  --sand: #8A7D68;
  --sand-soft: #3A342C;
  --success: #9BC892;
  --error: #E7A399;
  --warning: #E2C48A;
  --danger-soft: #3A2824;
  --danger-line: #5C3C36;
  --on-accent: #161714;
  --footer-bg: #10110E;
  --toast-bg: #F3F1EA;
  --toast-fg: #161714;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.38);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.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;
}

/* Layout */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.container--wide {
  width: min(100% - 2.5rem, var(--container-wide));
  margin-inline: auto;
}

/* Typography utilities */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--ink);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  font-size: var(--text-md);
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 36em;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 34rem;
  margin-bottom: var(--space-7);
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-wrap: balance;
}

.section-head p {
  color: var(--ink-soft);
  font-size: var(--text-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.35rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              transform var(--duration) var(--ease);
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn--secondary:hover {
  background: var(--surface);
  border-color: var(--ink);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  min-height: 40px;
  padding-inline: 0.75rem;
}

.btn--ghost:hover { color: var(--ink); }

.btn--demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--sand-soft);
  color: var(--accent-hover);
  border-color: var(--sand);
}

.btn--demo:hover {
  background: var(--sand);
  color: var(--accent-hover);
  border-color: var(--accent-mid);
}

.btn--full { width: 100%; }

/* Form controls */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.input,
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 52px;
  padding: 0 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}

.input:focus-within,
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input input,
.input select,
.input textarea,
.search-bar input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  min-width: 0;
  font-size: var(--text-base);
}

.input select {
  appearance: none;
  cursor: pointer;
  padding: 0.85rem 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A887F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.15rem center;
  padding-right: 1.25rem;
}

.input--textarea {
  align-items: flex-start;
  min-height: 0;
  padding: 0.85rem 1rem;
}

.input textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.5;
  min-height: 7rem;
}

.field-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.req {
  color: var(--error);
  font-weight: 700;
}

.input input::placeholder,
.input textarea::placeholder,
.search-bar input::placeholder {
  color: var(--ink-muted);
}

.search-bar svg {
  flex-shrink: 0;
  color: var(--ink-muted);
}

/* Price */
.price {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.price--sm { font-size: var(--text-lg); }
.price--md { font-size: var(--text-xl); }

.price-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.price-old {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-decoration: line-through;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge--new {
  background: var(--sand-soft);
  color: #6B5A3A;
}

.badge--popular {
  gap: 0.28rem;
  background: var(--accent);
  color: var(--on-accent);
}

html[data-theme="night"] .badge--new {
  color: #E6D4B4;
}

html[data-theme="night"] input:-webkit-autofill,
html[data-theme="night"] textarea:-webkit-autofill,
html[data-theme="night"] select:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 9999s ease-out;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
}

.theme-toggle:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.theme-toggle__icon--sun { display: none; }
html[data-theme="night"] .theme-toggle__icon--moon { display: none; }
html[data-theme="night"] .theme-toggle__icon--sun { display: block; }

.badge--popular svg {
  flex-shrink: 0;
}
