/* =========================================================
   BIZTIMIZE — DESIGN SYSTEM v5.0
   Warm editorial palette · ivory + espresso + burnt sienna
   ========================================================= */

:root {
  /* Palette */
  --ivory:        #F4EFE6;
  --ivory-2:      #EBE4D6;
  --paper:        #FBF8F2;
  --espresso:     #1C1814;
  --espresso-2:   #2A2520;
  --ink-70:       rgba(28, 24, 20, 0.72);
  --ink-50:       rgba(28, 24, 20, 0.52);
  --ink-30:       rgba(28, 24, 20, 0.28);
  --ink-12:       rgba(28, 24, 20, 0.12);
  --ink-06:       rgba(28, 24, 20, 0.06);
  --accent:       #B8552E;
  --accent-ink:   #8C3F20;

  /* Semantic */
  --bg:          var(--ivory);
  --bg-raised:   var(--paper);
  --fg:          var(--espresso);
  --fg-soft:     var(--ink-70);
  --fg-muted:    var(--ink-50);
  --rule:        var(--ink-12);
  --rule-strong: var(--ink-30);
  --surface:     rgba(28, 24, 20, 0.04);
  --success:     #2D7A4F;
  --error:       #B23A2A;

  /* Typography */
  --font-display: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --font-ui:      'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Radius */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;

  /* Layout */
  --maxw: 1240px;
  --gutter: 32px;

  /* Spacing scale (8px-based) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Ink aliases (semantic) */
  --ink-0: var(--fg);
  --ink-1: var(--fg);
  --ink-2: var(--fg-soft);
}

/* =========================================================
   RESET / NORMALIZE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; transition: color 160ms ease; }
a:hover { color: var(--accent-ink); }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }

::selection { background: var(--accent); color: var(--paper); }

/* Subtle grain — page-wide */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(28, 24, 20, 0.035) 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: multiply;
  opacity: 0.6;
}

/* =========================================================
   LAYOUT PRIMITIVES
   ========================================================= */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
  z-index: 2;
}

main, header, footer { position: relative; z-index: 2; }

/* =========================================================
   TYPOGRAPHY
   ========================================================= */
.text-display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.028em;
}
.text-balance { text-wrap: balance; }
.text-pretty  { text-wrap: pretty;  }
.text-italic  { font-style: italic; }
.text-accent  { color: var(--accent-ink); }
.text-mono    { font-family: var(--font-mono); }

/* Eyebrow — small uppercase mono label with accent dot */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}
.eyebrow.no-dot::before { display: none; }

/* Section head — index + kicker + title (+ optional blurb) */
.section-head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
  align-items: end;
  padding: 28px 0 44px;
}
.section-head__index {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
  margin-bottom: 14px;
}
.section-head__title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.4vw, 56px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.section-head__blurb {
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-soft);
  max-width: 520px;
  text-wrap: pretty;
}

@media (max-width: 760px) {
  .section-head {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px 0 32px;
  }
  .section-head__title { font-size: clamp(30px, 8vw, 44px); }
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.btn--primary:hover {
  color: var(--bg);
  background: var(--espresso-2);
}

.btn--ghost {
  border-color: var(--rule-strong);
  color: var(--fg);
}
.btn--ghost:hover {
  background: var(--surface);
  color: var(--fg);
}

.btn--accent {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.btn--accent:hover {
  background: var(--accent-ink);
  color: var(--paper);
}

.btn--sm {
  padding: 10px 16px;
  font-size: 13px;
  gap: 8px;
}
.btn--lg {
  padding: 16px 26px;
  font-size: 15.5px;
}
.btn--block {
  width: 100%;
  justify-content: center;
}

.btn__arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Inline arrow link */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-ink);
  font-weight: 500;
  font-size: 13px;
}
.link-arrow:hover {
  color: var(--accent);
}
.link-arrow::after {
  content: "→";
  transition: transform 160ms ease;
}
.link-arrow:hover::after {
  transform: translateX(3px);
}

/* =========================================================
   FORMS
   ========================================================= */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field__input,
.field__select,
.field__textarea {
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  outline: none;
  border-radius: 0;
  transition: border-color 160ms ease;
  width: 100%;
}
.field__input:focus,
.field__select:focus,
.field__textarea:focus {
  border-bottom-color: var(--accent);
}
.field__input::placeholder,
.field__textarea::placeholder {
  color: var(--ink-30);
}
.field__select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%231C1814' stroke-opacity='0.5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0 center;
  padding-right: 24px;
}
.field__textarea {
  resize: vertical;
  min-height: 96px;
}

.form-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px;
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Crispy-form / Django form fallbacks */
.form-card label,
.form-card .form-group label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}
.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="tel"],
.form-card input[type="url"],
.form-card input[type="password"],
.form-card select,
.form-card textarea {
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  outline: none;
  border-radius: 0;
  width: 100%;
  transition: border-color 160ms ease;
  margin-bottom: 14px;
}
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
  border-bottom-color: var(--accent);
}
.form-card .form-group,
.form-card .mb-3 {
  margin-bottom: 8px;
}
.form-card .help-block,
.form-card .form-text {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: -8px;
  margin-bottom: 12px;
}
.form-card .errorlist,
.form-card .invalid-feedback {
  list-style: none;
  padding: 0;
  margin: -8px 0 12px;
  font-size: 12.5px;
  color: var(--error);
}
.form-card .asteriskField { color: var(--accent); margin-left: 4px; }

/* =========================================================
   ALERTS
   ========================================================= */
.alert {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  background: var(--surface);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.alert--success {
  background: rgba(45, 122, 79, 0.06);
  border-color: rgba(45, 122, 79, 0.32);
  color: var(--success);
}
.alert--error {
  background: rgba(178, 58, 42, 0.06);
  border-color: rgba(178, 58, 42, 0.32);
  color: var(--error);
}

/* =========================================================
   BADGES / CHIPS
   ========================================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: transparent;
}
.chip--accent {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: rgba(184, 85, 46, 0.06);
}
.chip--filled {
  background: var(--surface);
  border-color: var(--rule);
}

/* =========================================================
   FADE-IN-ON-VIEW (replaces AOS)
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 720ms cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 720ms cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}
.reveal[data-reveal-delay="100"] { transition-delay: 100ms; }
.reveal[data-reveal-delay="200"] { transition-delay: 200ms; }
.reveal[data-reveal-delay="300"] { transition-delay: 300ms; }
.reveal[data-reveal-delay="400"] { transition-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* =========================================================
   UTILITIES
   ========================================================= */
.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;
}
.text-center { text-align: center; }
.is-hidden { display: none !important; }

/* Skip-to-content (accessibility) */
.skip-link {
  position: absolute;
  left: 12px; top: -40px;
  z-index: 1000;
  padding: 8px 14px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  border-radius: var(--radius-sm);
  transition: top 180ms ease;
}
.skip-link:focus {
  top: 12px;
  outline: none;
}

/* Body scroll lock when mobile menu is open */
body.nav-open {
  overflow: hidden;
}

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