/* =====================================================================
   Sowp brand -- the product's OWN pages only (templates/*.html).
   Customer sites keep their own design_system.py presets and fonts.
   Linked AFTER each page's inline <style>, so the shared components and
   polish below win over the per-page rules they replace.

   TYPE -- three faces, split by character, not by role
   ----
   'Bon Digits'  Bon Pro "Farsi Numerals", cut to 0-9 only. It draws the
                 plain ASCII digits as Persian ones, so a price typed as
                 "250000" reads ۲۵۰۰۰۰ without anyone converting it. First
                 in the stack, so it claims the digits and nothing else.
                 .ltr / email / url fields skip it (see LATIN ISLANDS).
   'Raleway'     SIL OFL 1.1 (Raleway-OFL.txt). Latin letters. Variable,
                 upright + italic, 100-900.
   'Bon'         Bon Pro (commercial, Fontiran). Persian. Variable,
                 50 (Hairline) - 900 (Black), 33 KB for every weight.
   A browser takes each character from the first face that has it, and
   unicode-range means it only downloads a face once a page uses it.

   Browsers too old for variable fonts get the static cuts instead --
   all ten Bon weights (woff2, then woff) and all eighteen Raleway ones.
   They sit inside @supports not(...), so a modern browser never even
   discovers them. scripts/build_brand_fonts.py rebuilds the folder.

   COLOUR
   ------
   True Cobalt  #16207F  headings, logo letters, dark bands
   Slate Indigo #4260E6  primary action, the W
   Pumpkin Spice #FE7524 accent, highlights, "in progress"
   Bright Snow  #FAFAFA  page ground
   Onyx         #0D0D0D  body text
   ===================================================================== */

/* ---------- Bon Digits: Farsi Numerals, 0-9 only ---------- */
@font-face { font-family: 'Bon Digits'; font-weight: 50;  font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Hairline.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 100; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Thin.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 200; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Extralight.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 300; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Light.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 400; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 500; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 600; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 700; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Bold.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 800; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Extrabold.woff2') format('woff2'); }
@font-face { font-family: 'Bon Digits'; font-weight: 900; font-display: swap; unicode-range: U+0030-0039; src: url('/static/fonts/brand/bon-digits-Black.woff2') format('woff2'); }

/* ---------- Raleway + Bon, variable ---------- */
@font-face {
  font-family: 'Raleway'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/static/fonts/brand/Raleway-Variable-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Raleway'; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url('/static/fonts/brand/Raleway-Italic-Variable-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bon'; font-style: normal; font-weight: 50 900; font-display: swap;
  src: url('/static/fonts/brand/bon-Variable-fa.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---------- Static cuts, for browsers without variable fonts ---------- */
@supports not (font-variation-settings: normal) {
  @font-face { font-family: 'Bon'; font-weight: 50;  font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Hairline.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Hairline.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 100; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Thin.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Thin.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 200; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Extralight.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Extralight.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 300; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Light.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Light.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Regular.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Regular.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Medium.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Medium.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-SemiBold.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-SemiBold.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Bold.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Bold.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 800; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Extrabold.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Extrabold.woff') format('woff'); }
  @font-face { font-family: 'Bon'; font-weight: 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; src: url('/static/fonts/brand/bon-NonEnglish-Black.woff2') format('woff2'), url('/static/fonts/brand/bon-NonEnglish-Black.woff') format('woff'); }

  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 100; font-display: swap; src: url('/static/fonts/brand/Raleway-Thin-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 200; font-display: swap; src: url('/static/fonts/brand/Raleway-ExtraLight-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 300; font-display: swap; src: url('/static/fonts/brand/Raleway-Light-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/brand/Raleway-Regular-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/brand/Raleway-Medium-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/fonts/brand/Raleway-SemiBold-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/brand/Raleway-Bold-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 800; font-display: swap; src: url('/static/fonts/brand/Raleway-ExtraBold-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: normal; font-weight: 900; font-display: swap; src: url('/static/fonts/brand/Raleway-Black-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 100; font-display: swap; src: url('/static/fonts/brand/Raleway-ThinItalic-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 200; font-display: swap; src: url('/static/fonts/brand/Raleway-ExtraLightItalic-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 300; font-display: swap; src: url('/static/fonts/brand/Raleway-LightItalic-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 400; font-display: swap; src: url('/static/fonts/brand/Raleway-Italic-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 500; font-display: swap; src: url('/static/fonts/brand/Raleway-MediumItalic-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 600; font-display: swap; src: url('/static/fonts/brand/Raleway-SemiBoldItalic-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 700; font-display: swap; src: url('/static/fonts/brand/Raleway-BoldItalic-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 800; font-display: swap; src: url('/static/fonts/brand/Raleway-ExtraBoldItalic-latin.woff2') format('woff2'); }
  @font-face { font-family: 'Raleway'; font-style: italic; font-weight: 900; font-display: swap; src: url('/static/fonts/brand/Raleway-BlackItalic-latin.woff2') format('woff2'); }
}

:root {
  --brand-cobalt: #16207F;
  --brand-indigo: #4260E6;
  --brand-pumpkin: #FE7524;
  --brand-snow: #FAFAFA;
  --brand-onyx: #0D0D0D;
  /* Vazirmatn stays at the end: every visitor who has seen a generated
     site already has it cached, and it keeps the page Persian if the Bon
     files ever fail to arrive. */
  --brand-font: 'Bon Digits', 'Raleway', 'Bon', 'Vazirmatn', Tahoma, sans-serif;
  --brand-font-latin: 'Raleway', 'Bon', 'Vazirmatn', Tahoma, sans-serif;
  --brand-ring: 0 0 0 3px rgba(66, 96, 230, 0.35);
}

/* ---------- Page ---------- */
/* LEFT-TO-RIGHT ISLANDS (1.0.0). The pages are right to left; the
   header, the funnel's top bar and step bar, and the landing page's
   1-2-3 row are laid out left to right (dir="ltr" in the markup): logo
   on the left, steps counting from the left. Their words are still
   Persian, so each line takes the direction of its own first letter --
   otherwise the full stop in "... بنویس." is thrown to the wrong end. */
[dir="ltr"] :where(h2, h3, p, span, a, li, label, small, strong, div, button) {
  unicode-bidi: plaintext;
}

html { background: var(--ui-bg, var(--brand-snow)); }
body {
  font-family: var(--brand-font);
  font-variant-numeric: lining-nums;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { color: var(--brand-cobalt); letter-spacing: -0.01em; }
::selection { background: rgba(66, 96, 230, 0.22); }
:focus-visible { outline: none; box-shadow: var(--brand-ring); border-radius: 8px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-radius: inherit; }

/* LATIN ISLANDS: an email, a URL or a domain keeps its ASCII digits --
   "info@cafe1400.ir" rendered as "cafe۱۴۰۰" is a different address. */
.ltr, bdi[dir="ltr"], input[dir="ltr"], input[type="email"], input[type="url"], code, kbd, pre {
  font-family: var(--brand-font-latin);
}
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------- Logo (templates/partials/brand.html) ---------- */
.brand-link { display: inline-flex; align-items: center; text-decoration: none; line-height: 0; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-logo.sm { height: 24px; }
.brand-logo.lg { height: 42px; }
.brand-logo .bl-ink { fill: var(--brand-cobalt); }
.brand-logo .bl-mark, .brand-mark .bl-mark, .brand-lockup .bl-mark { fill: var(--brand-indigo); }
.brand-lockup .bl-ink { fill: var(--brand-cobalt); }
.brand-lockup { height: 56px; width: auto; display: block; }
.brand-mark { height: 1em; width: auto; display: inline-block; vertical-align: -0.12em; }
.on-dark .brand-logo .bl-ink, .on-dark .brand-lockup .bl-ink { fill: var(--brand-snow); }
.on-dark .brand-mark .bl-mark { fill: var(--brand-snow); }
.box-logo { margin-bottom: 20px; }

/* ---------- Shared top bar + steps (funnel pages) ---------- */
.brand-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; max-width: 1100px; margin: 0 auto; padding: 18px 20px 0; box-sizing: border-box;
  align-self: center;
}
.brand-topbar .tb-links { display: flex; gap: 16px; align-items: center; font-size: 0.88rem; font-weight: 600; }
.brand-topbar .tb-links a { color: var(--ui-text-muted); text-decoration: none; transition: color .15s; display: inline-block; padding: 8px 4px; }
.brand-topbar .tb-links a:hover { color: var(--brand-indigo); }

.brand-steps {
  list-style: none; margin: 18px auto 0; padding: 0 20px; width: 100%; max-width: 680px; box-sizing: border-box; align-self: center;
  display: flex; align-items: flex-start; counter-reset: step;
}
.brand-steps li {
  flex: 1; position: relative; text-align: center; counter-increment: step;
  font-size: 0.74rem; font-weight: 600; color: var(--ui-text-muted);
}
.brand-steps li::before {
  content: counter(step, persian); display: grid; place-items: center;
  width: 30px; height: 30px; margin: 0 auto 6px; border-radius: 50%;
  background: var(--ui-surface, #fff); border: 1.5px solid var(--ui-border, #E3E6F0);
  font-size: 0.8rem; font-weight: 800; color: var(--ui-text-muted);
  position: relative; z-index: 1; transition: all .25s ease;
}
/* The connector runs from this dot back to the previous one, in either direction. */
.brand-steps li + li::after {
  content: ""; position: absolute; top: 15px; inset-inline-start: calc(-50% + 15px); inset-inline-end: calc(50% + 15px);
  height: 2px; background: var(--ui-border, #E3E6F0);
}
.brand-steps li.done::before { content: "✓"; background: var(--brand-indigo); border-color: var(--brand-indigo); color: #fff; }
.brand-steps li.done + li::after, .brand-steps li.done::after { background: var(--brand-indigo); }
.brand-steps li.current { color: var(--brand-cobalt); }
.brand-steps li.current::before {
  background: var(--brand-cobalt); border-color: var(--brand-cobalt); color: #fff;
  box-shadow: 0 0 0 5px rgba(22, 32, 127, 0.12);
}
@media (max-width: 560px) {
  .brand-steps li { font-size: 0; }           /* dots only; the label is the page title */
  .brand-steps li.current { font-size: 0.7rem; }
}

/* ---------- The W as a loader ---------- */
.brand-loader { display: block; width: 96px; margin: 8px auto 22px; }
.brand-loader svg { width: 100%; height: auto; display: block; overflow: visible; }
.brand-loader .bl-mark { fill: var(--brand-indigo); }
.brand-loader .bl-track { fill: rgba(66, 96, 230, 0.14); }
.brand-loader .bl-draw { animation: blDraw 1.6s cubic-bezier(.65, 0, .35, 1) infinite; }
@keyframes blDraw {
  0%   { clip-path: inset(0 100% 0 0); }
  55%  { clip-path: inset(0 0 0 0); }
  80%  { clip-path: inset(0 0 0 0); opacity: 1; }
  100% { clip-path: inset(0 0 0 0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-loader .bl-draw { animation: none; }
}

/* ---------- Footer ---------- */
.brand-footer {
  background: var(--brand-cobalt); color: rgba(250, 250, 250, 0.72);
  margin-top: 56px; padding: 44px 24px 36px; text-align: center; font-size: 0.84rem;
}
.brand-footer .brand-lockup { height: 64px; margin: 0 auto 16px; }
.brand-footer .bf-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 0 0 18px; }
.brand-footer a { color: var(--brand-snow); text-decoration: none; font-weight: 600; display: inline-block; padding: 8px 4px; }
.brand-footer a:hover { color: var(--brand-pumpkin); }
.brand-footer small { display: block; opacity: .7; }

/* ---------- Buttons: one shape, one lift, everywhere ---------- */
.btn-primary, .btn-new, button[type="submit"] { transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn-primary:hover, .btn-new:hover { box-shadow: 0 10px 24px -8px rgba(66, 96, 230, 0.55); }

/* ---------- Page frame for pages with the shared top bar ----------
   Those pages used to centre one card in the viewport with body as the
   flex container; the card now centres inside <main> instead, so the
   bar can sit above it. */
body.has-topbar {
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  padding: 0; min-height: 100vh;
}
.brand-main {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px 20px 48px; width: 100%; box-sizing: border-box;
}
.brand-main > .box, .brand-main > .wrap { width: 100%; }
.brand-main > .wrap { padding-top: 0; }

/* ---------- The white W, as a watermark on the dark call to action ---------- */
.cta-band::after {
  content: ""; position: absolute; left: -24px; bottom: -46px; width: 300px; height: 206px;
  background: url('/static/brand/sowp-mark-white.svg') no-repeat center / contain;
  opacity: 0.07; pointer-events: none;
}
.band-ink { position: relative; overflow: hidden; }
.band-ink::after {
  content: ""; position: absolute; right: -60px; top: 40px; width: 420px; height: 288px;
  background: url('/static/brand/sowp-mark-white.svg') no-repeat center / contain;
  opacity: 0.04; pointer-events: none;
}
.band-ink > * { position: relative; z-index: 1; }

/* Raleway's "+" is drawn small; as a button icon it needs to read. */
.ic-plus { font-size: 1.45em; font-weight: 500; line-height: 0; vertical-align: -0.1em; margin-inline-end: 2px; }
/* A failed build must not keep looking busy: the W stops, drawn, and greys out. */
.brand-loader.stopped .bl-draw { animation: none; opacity: 1; clip-path: none; fill: var(--ui-text-muted, #5B6178); }
