/* ─── Objs form example — styles ──────────────────────────────────────────── */

.lib-link { color: #64748b; font-size: .875rem; text-decoration: none; }
.lib-link:hover { color: #2563eb; }

:root {
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --primary:      #2563eb;
  --primary-h:    #1d4ed8;
  --success:      #16a34a;
  --error:        #dc2626;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --border-focus: #2563eb;
  --radius:       10px;
  --shadow:       0 24px 64px rgba(0,0,0,.14);
  --ease:         cubic-bezier(.4,0,.2,1);
  --dur:          .24s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── Page layout ─────────────────────────────────────────────────────────── */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3rem;
  padding: 3rem 2rem 5rem;
}

.page__hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.page__hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}

.page__hero p {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 36ch;
  line-height: 1.6;
}

/* ─── Architecture diagram ────────────────────────────────────────────────── */

.page__arch,
.page__fragments,
.page__why {
  width: 100%;
  max-width: 640px;
}

.page__arch h2,
.page__fragments h2,
.page__why h2 {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.code-block {
  background: #0f172a;
  color: #94a3b8;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: .8125rem;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
}

.code-block .hl      { color: #7dd3fc; }
.code-block .ok      { color: #86efac; }
.code-block .mut     { color: #fbbf24; }
.code-block .comment { color: #475569; font-style: italic; }

/* ─── Key patterns fragments ──────────────────────────────────────────────── */

.page__fragments { display: flex; flex-direction: column; gap: 1rem; }

.fragment { display: flex; flex-direction: column; gap: .5rem; }
.fragment__label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
}
.fragment__label code {
  background: #f1f5f9;
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .75rem;
  color: var(--text);
}

/* ─── Why Objs ────────────────────────────────────────────────────────────── */

.why-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 560px) { .why-compare { grid-template-columns: 1fr; } }

.why-col {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.why-col h3 {
  font-size: .9375rem;
  font-weight: 700;
  margin-bottom: .25rem;
}
.why-col--react h3 { color: var(--text-muted); }
.why-col--objs  h3 { color: var(--primary); }
.why-col pre {
  flex: 1;
  font-size: .8125rem;
  line-height: 1.65;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
}
.why-col--react pre { border-left: 3px solid rgba(239, 68, 68, .4); padding-left: 1rem; }
.why-col--objs  pre { border-left: 3px solid rgba(34, 197, 94, .5);  padding-left: 1rem; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  padding: .6875rem 1.375rem;
  line-height: 1;
  text-decoration: none;
}

.btn:active { transform: scale(.97); }

.btn--primary {
  background: var(--primary);
  color: #fff;
}
.btn--primary:hover:not(:disabled) { background: var(--primary-h); }
.btn--primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.btn--ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn--ghost:hover { background: #eff6ff; }

.btn--icon {
  background: transparent;
  color: var(--text-muted);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  font-size: 1rem;
  flex-shrink: 0;
}
.btn--icon:hover { background: var(--border); color: var(--text); }

.btn--lg { padding: .875rem 2rem; font-size: 1.0625rem; }
.btn--full { width: 100%; }

/* ─── Spinner ─────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Drawer ──────────────────────────────────────────────────────────────── */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.drawer--open { pointer-events: auto; }

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0);
  transition: background var(--dur) var(--ease);
}

.drawer--open .drawer__backdrop {
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
}

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
}

.drawer--open .drawer__panel { transform: translateX(0); }

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer__title {
  font-size: 1.125rem;
  font-weight: 700;
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 1.5rem;
}

/* ─── Contact form ────────────────────────────────────────────────────────── */

.contact-form {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Fields area */
.form__fields {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

/* Success area */
.form__success {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex: 1;
  text-align: center;
  animation: fadeUp .35s var(--ease) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.success-icon {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  animation: pop .4s var(--ease) both;
}

@keyframes pop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.success-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.success-body {
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Form fields ─────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.field__label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
}

.field__input {
  width: 100%;
  padding: .6875rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9375rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  resize: vertical;
}

.field__input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3.5px rgba(37,99,235,.14);
}

.field__input--error {
  border-color: var(--error) !important;
}
.field__input--error:focus {
  box-shadow: 0 0 0 3.5px rgba(220,38,38,.14);
}

.field__input--ok {
  border-color: var(--success);
}
.field__input--ok:focus {
  box-shadow: 0 0 0 3.5px rgba(22,163,74,.14);
}

.field__error {
  font-size: .8125rem;
  color: var(--error);
  min-height: .875rem;
  line-height: 1.3;
}

/* Submit row */
.form__submit-row {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}

/* ─── Promo code field ────────────────────────────────────────────────────── */

.field__optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: .8125rem;
}

.promo-badge {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .8125rem;
  font-weight: 500;
  min-height: 1.25rem;
  line-height: 1.25rem;
  transition: opacity .18s;
}

.promo-badge--checking { color: var(--text-muted); }
.promo-badge--valid    { color: var(--success); font-weight: 600; }
.promo-badge--invalid  { color: var(--error); }

/* ─── Spinner variants ────────────────────────────────────────────────────── */

.spinner--sm {
  width: .8125em;
  height: .8125em;
  border-width: 1.5px;
  flex-shrink: 0;
}

.spinner--dark {
  border-color: rgba(37,99,235,.25);
  border-top-color: var(--primary);
}

/* ─── Discount badge (success panel) ─────────────────────────────────────── */

.success-discount { min-height: 2rem; display: flex; align-items: center; }

.discount-badge {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  color: #16a34a;
  padding: .5rem 1.125rem;
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 600;
  animation: fadeUp .3s var(--ease) both;
}
