/* ==========================================================================
   BlockForge — brand.css
   Design tokens + reusable components shared by every page of the site
   (landing, login/register, user dashboard, admin panel).
   Fonts are self-hosted in /static/fonts (SIL OFL, licenses alongside).

   TOKENS (CSS variables on :root)
     --bf-font-display / --bf-font-body     Lilita One (headings) / Nunito (text)
     --bf-ink, --bf-ink-2, --bf-muted        text colours (dark navy scale)
     --bf-paper, --bf-surface, --bf-line     page background, card surface, borders
     --bf-blue / --bf-yellow / --bf-red / --bf-green / --bf-orange / --bf-purple / --bf-sky
                                             saturated "plastic block" palette,
                                             each with a -d (darker, bevel) variant
     --bf-r-sm / --bf-r / --bf-r-lg / --bf-r-pill   corner radii
     --bf-bevel, --bf-shadow, --bf-shadow-lg chunky block shadows

   COMPONENTS
     .bf-btn                 chunky beveled button (also on <a>). Variants:
       .bf-btn--primary      blue (default call to action)
       .bf-btn--secondary    white with ink text
       .bf-btn--accent       yellow
       .bf-btn--danger       red (destructive actions)
       .bf-btn--ghost        transparent, for toolbars
       .bf-btn--sm / --lg    sizes;  [disabled] / .is-disabled supported
     .bf-card                white block panel with bevel; .bf-card--flat (no lift),
                             .bf-card__title, .bf-card__body helpers
     .bf-label               form label (block, bold)
     .bf-input               text input / select / textarea (add .is-invalid for errors)
     .bf-field               wrapper: label + input + .bf-help / .bf-error message
     .bf-nav                 top navigation bar: .bf-nav__brand, .bf-nav__links,
                             .bf-nav__link (.is-active), .bf-nav__actions
     .bf-logo                logo lock-up (cube mark + wordmark)
     .bf-badge               status pill. Variants: --pending --active --disabled
                             --running --done --failed
     .bf-progress            progress bar; set the value with
                             style="--bf-progress: 42%"; add .is-running for stripes,
                             .bf-progress__label for the optional text
     .bf-table               data table (wrap in .bf-table-wrap for horizontal scroll)
     .bf-alert               message box: --info --success --error
     .bf-container           centred max-width wrapper
     .bf-sr-only             visually hidden, screen-reader only
   ========================================================================== */

@font-face {
  font-family: "Lilita One";
  src: url("../fonts/lilita-one-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-latin-wght.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --bf-font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --bf-font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bf-ink: #1b2141;
  --bf-ink-2: #39406b;
  --bf-muted: #6a7099;
  --bf-paper: #f3f7ff;
  --bf-surface: #ffffff;
  --bf-line: #d9e0f2;

  --bf-blue: #2f7bff;     --bf-blue-d: #1b56c9;
  --bf-yellow: #ffcb2e;   --bf-yellow-d: #d99a00;
  --bf-red: #ff4b55;      --bf-red-d: #c8242f;
  --bf-green: #22c55e;    --bf-green-d: #15903f;
  --bf-orange: #ff8a2a;   --bf-orange-d: #cf5f05;
  --bf-purple: #8b5cf6;   --bf-purple-d: #6234d6;
  --bf-sky: #7cc8ff;      --bf-sky-d: #3c98dc;

  --bf-r-sm: 8px;
  --bf-r: 14px;
  --bf-r-lg: 22px;
  --bf-r-pill: 999px;

  --bf-bevel: inset 0 3px 0 rgba(255, 255, 255, .38), inset 0 -4px 0 rgba(0, 0, 0, .16);
  --bf-shadow: 0 6px 0 rgba(27, 33, 65, .16), 0 14px 26px -10px rgba(27, 33, 65, .28);
  --bf-shadow-lg: 0 10px 0 rgba(27, 33, 65, .14), 0 28px 50px -18px rgba(27, 33, 65, .38);
  --bf-focus: 0 0 0 4px rgba(47, 123, 255, .35);
}

/* ---------- base helpers ---------- */
.bf-container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.bf-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- logo ---------- */
.bf-logo {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--bf-font-display); font-size: 1.45rem; letter-spacing: .01em;
  color: var(--bf-ink); text-decoration: none; line-height: 1;
}
.bf-logo svg { width: 1.6em; height: 1.6em; flex: none; filter: drop-shadow(0 3px 0 rgba(27,33,65,.18)); }
.bf-logo b { color: var(--bf-blue); font-weight: 400; }

/* ---------- buttons ---------- */
.bf-btn {
  --c: var(--bf-blue); --cd: var(--bf-blue-d); --fg: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .7em 1.35em;
  font: 400 1.08rem/1 var(--bf-font-display); letter-spacing: .02em;
  color: var(--fg); background: var(--c);
  border: 0; border-radius: var(--bf-r); cursor: pointer; text-decoration: none;
  box-shadow: var(--bf-bevel), 0 5px 0 var(--cd), 0 10px 18px -8px rgba(27, 33, 65, .45);
  transform: translateY(0);
  transition: transform .12s ease, box-shadow .12s ease, filter .15s ease;
  -webkit-tap-highlight-color: transparent; user-select: none; white-space: nowrap;
}
.bf-btn:hover { filter: brightness(1.06) saturate(1.05); transform: translateY(-2px);
  box-shadow: var(--bf-bevel), 0 7px 0 var(--cd), 0 14px 22px -8px rgba(27, 33, 65, .45); }
.bf-btn:active { transform: translateY(4px);
  box-shadow: var(--bf-bevel), 0 1px 0 var(--cd), 0 4px 8px -4px rgba(27, 33, 65, .4); }
.bf-btn:focus-visible { outline: none; box-shadow: var(--bf-bevel), 0 5px 0 var(--cd), var(--bf-focus); }
.bf-btn--primary { --c: var(--bf-blue); --cd: var(--bf-blue-d); --fg: #fff; }
.bf-btn--secondary { --c: #fff; --cd: #c6cfe6; --fg: var(--bf-ink); }
.bf-btn--accent { --c: var(--bf-yellow); --cd: var(--bf-yellow-d); --fg: var(--bf-ink); }
.bf-btn--danger { --c: var(--bf-red); --cd: var(--bf-red-d); --fg: #fff; }
.bf-btn--ghost { --c: transparent; --cd: transparent; --fg: var(--bf-ink); box-shadow: none; }
.bf-btn--ghost:hover { background: rgba(27, 33, 65, .07); box-shadow: none; }
.bf-btn--sm { min-height: 38px; padding: .5em 1em; font-size: .95rem; border-radius: 11px; }
.bf-btn--lg { min-height: 58px; padding: .8em 1.7em; font-size: 1.3rem; border-radius: 18px; }
.bf-btn[disabled], .bf-btn.is-disabled {
  cursor: not-allowed; filter: grayscale(.7) opacity(.6); transform: none; pointer-events: none;
}

/* ---------- cards ---------- */
.bf-card {
  background: var(--bf-surface); color: var(--bf-ink);
  border: 2px solid rgba(27, 33, 65, .06); border-radius: var(--bf-r-lg);
  box-shadow: var(--bf-shadow), inset 0 -5px 0 rgba(27, 33, 65, .05);
  padding: clamp(18px, 3vw, 28px);
}
.bf-card--flat { box-shadow: inset 0 -4px 0 rgba(27, 33, 65, .05); }
.bf-card__title { margin: 0 0 .4em; font: 400 1.35rem/1.15 var(--bf-font-display); }
.bf-card__body { color: var(--bf-ink-2); }

/* ---------- forms ---------- */
/* every brand component sizes with border-box, so width:100% never overflows its container */
.bf-input, .bf-btn, .bf-card, .bf-field, .bf-nav, .bf-alert, .bf-progress, .bf-table-wrap { box-sizing: border-box; }
.bf-field { display: grid; gap: 6px; margin-bottom: 16px; min-width: 0; }
.bf-label { display: block; font: 800 .92rem/1.2 var(--bf-font-body); color: var(--bf-ink); }
.bf-input {
  width: 100%; max-width: 100%; min-height: 44px; padding: 9px 13px;
  font: 600 1rem/1.3 var(--bf-font-body); color: var(--bf-ink);
  background: #fff; border: 2px solid var(--bf-line); border-radius: 12px;
  box-shadow: inset 0 3px 0 rgba(27, 33, 65, .05);
  transition: border-color .15s, box-shadow .15s;
}
.bf-input::placeholder { color: #9aa1c4; }
.bf-input:focus { outline: none; border-color: var(--bf-blue); box-shadow: var(--bf-focus); }
.bf-input.is-invalid { border-color: var(--bf-red); }
textarea.bf-input { min-height: 110px; resize: vertical; }
.bf-help { font-size: .85rem; color: var(--bf-muted); }
.bf-error { font-size: .85rem; font-weight: 700; color: var(--bf-red-d); }

/* ---------- nav ---------- */
.bf-nav {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 14px; min-height: 64px;
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
  border: 2px solid rgba(255, 255, 255, .9); border-radius: 20px;
  box-shadow: 0 6px 0 rgba(27, 33, 65, .10), 0 18px 34px -20px rgba(27, 33, 65, .45);
}
.bf-nav__brand { flex: none; }
.bf-nav__links { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.bf-nav__link {
  display: inline-block; padding: 9px 12px; border-radius: 10px;
  font-weight: 800; font-size: .95rem; color: var(--bf-ink-2); text-decoration: none;
}
.bf-nav__link:hover { background: rgba(47, 123, 255, .1); color: var(--bf-blue-d); }
.bf-nav__link.is-active { background: var(--bf-ink); color: #fff; }
.bf-nav__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ---------- badges ---------- */
.bf-badge {
  --c: #e8ecf8; --fg: var(--bf-ink-2);
  display: inline-flex; align-items: center; gap: .4em;
  padding: .32em .75em; border-radius: var(--bf-r-pill);
  font: 800 .78rem/1 var(--bf-font-body); letter-spacing: .04em; text-transform: uppercase;
  color: var(--fg); background: var(--c);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12);
}
.bf-badge::before { content: ""; width: .55em; height: .55em; border-radius: 2px; background: currentColor; }
.bf-badge--pending  { --c: #fff2c7; --fg: #8a5a00; }
.bf-badge--active   { --c: #d5f8e2; --fg: #0f7a37; }
.bf-badge--disabled { --c: #e7e9f0; --fg: #636a86; }
.bf-badge--running  { --c: #dbe8ff; --fg: #1b56c9; }
.bf-badge--running::before { animation: bf-blink 1s steps(2) infinite; }
.bf-badge--done     { --c: #d5f8e2; --fg: #0f7a37; }
.bf-badge--failed   { --c: #ffe0e2; --fg: #b81d29; }
@keyframes bf-blink { 50% { opacity: .2; } }

/* ---------- progress ---------- */
.bf-progress {
  --bf-progress: 0%;
  position: relative; height: 22px; overflow: hidden;
  background: #e6ebf8; border-radius: 11px;
  box-shadow: inset 0 3px 0 rgba(27, 33, 65, .08);
}
.bf-progress::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--bf-progress);
  background: linear-gradient(var(--bf-green), var(--bf-green));
  border-radius: 11px; box-shadow: var(--bf-bevel);
  transition: width .4s ease;
}
.bf-progress.is-running::after {
  background:
    repeating-linear-gradient(-45deg, rgba(255,255,255,.22) 0 10px, transparent 10px 20px),
    linear-gradient(var(--bf-blue), var(--bf-blue));
  background-size: 28px 28px, auto;
  animation: bf-stripes .8s linear infinite;
}
.bf-progress__label {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; white-space: nowrap;
  font: 800 .78rem/1 var(--bf-font-body); color: var(--bf-ink); mix-blend-mode: normal;
}
@keyframes bf-stripes { to { background-position: 28px 0, 0 0; } }

/* ---------- tables ---------- */
.bf-table-wrap { overflow-x: auto; border-radius: var(--bf-r); box-shadow: var(--bf-shadow); }
.bf-table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; font-size: .95rem; }
.bf-table th, .bf-table td { padding: 12px 14px; text-align: left; border-bottom: 2px solid #eef1fa; }
.bf-table th {
  font: 400 .95rem/1.2 var(--bf-font-display); letter-spacing: .02em;
  color: #fff; background: var(--bf-ink); white-space: nowrap;
}
.bf-table tbody tr:hover td { background: #f6f8ff; }
.bf-table tbody tr:last-child td { border-bottom: 0; }

/* ---------- alerts ---------- */
.bf-alert {
  --c: #dbe8ff; --fg: #1b3f8f;
  padding: 12px 16px; border-radius: 12px; font-weight: 700;
  color: var(--fg); background: var(--c); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .07);
}
.bf-alert--info { --c: #dbe8ff; --fg: #1b3f8f; }
.bf-alert--success { --c: #d5f8e2; --fg: #0f6a31; }
.bf-alert--error { --c: #ffe0e2; --fg: #a3161f; }

@media (prefers-reduced-motion: reduce) {
  .bf-btn, .bf-progress::after { transition: none; }
  .bf-progress.is-running::after, .bf-badge--running::before { animation: none; }
}
