/* My Business — the business owner's dashboard.
 *
 * One stylesheet for all seven templates that draw it: the two built-in
 * dashboards and the five page-builder blocks. Linked rather than inlined so a
 * page carrying five of those blocks fetches it once.
 *
 * EVERY COLOUR IS A TOKEN. These templates are platform code served to every
 * publication, so a literal here is one publisher's palette on everybody else's
 * site. Tints are color-mix() over a brand token rather than a second ramp —
 * CSS already does ramps and a registry of them would be a second vocabulary.
 * apps/businesses/dashboard_tokens_test.py fails the build on a hex, on a
 * Tailwind colour utility and on a literal rgb().
 *
 * --brand-primary is NOT a brand colour. It is a legacy alias for the header
 * background (CLAUDE.md 8.5) and is white on any theme left at the default, so
 * nothing here fills with it. --brand-accent is the one ink this draws with.
 *
 * Shape comes from --kit-* (CLAUDE.md 8.8), so a publication that has chosen a
 * soft, rounded kit gets a soft, rounded dashboard and an editorial one gets
 * hairlines. The fallbacks after each var() are the platform defaults from
 * design_kit.with_kit_defaults, for the rare page outside _design_tokens.html.
 */

.mb {
  --mb-rule: var(--brand-border-color);
  --mb-quiet: var(--brand-text-muted, var(--brand-muted));
  --mb-pad: var(--kit-space-card-pad, 24px);
  --mb-radius: var(--kit-radius-md, 8px);
  --mb-gap: var(--kit-space-gap, 24px);
  /* Knocked-out text on a filled accent. The paper colour rather than a fixed
   * white: on a dark theme white-on-accent and the page would fight. */
  --mb-on-accent: var(--brand-background);
  --mb-tint: color-mix(in srgb, var(--brand-accent) 10%, var(--brand-background));
  --mb-tint-rule: color-mix(in srgb, var(--brand-accent) 35%, var(--brand-background));

  font-family: var(--brand-font-body);
  color: var(--brand-text);
  /* The page builder's `.widget-placement` is `display: flex`, so this block is
   * a FLEX ITEM and sizes shrink-to-fit on the main axis. Measured on staging:
   * a 1200px placement containing a 455px block, which is why the figures band
   * collapsed to one column on a 1440px desktop. `max-width` alone cannot fix
   * that — it caps a width this never had. */
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

/* — type ————————————————————————————————————————————————— */

.mb h1, .mb h2, .mb h3 {
  font-family: var(--brand-font-heading);
  font-weight: var(--kit-heading-weight, 700);
  letter-spacing: var(--kit-heading-tracking, normal);
  margin: 0;
}
.mb-title { font-size: clamp(32px, 5.5vw, 54px); line-height: 1.05; }
.mb-h2 { font-size: clamp(22px, 3vw, 30px); line-height: 1.15; margin-bottom: 4px; }
.mb-h3 { font-size: 18px; line-height: 1.2; }
.mb-lede { font-size: 17px; line-height: 1.5; color: var(--mb-quiet); margin: 8px 0 0; }
.mb-meta { font-size: 14px; color: var(--mb-quiet); margin: 0; }
.mb-quiet { color: var(--mb-quiet); }

.mb-section { margin-top: 56px; }
.mb-section-head { margin-bottom: 20px; }

/* — grid ————————————————————————————————————————————————— */

.mb-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--mb-gap);
}
.mb-cols--wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.mb-cols--prose { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }

/* — surfaces ————————————————————————————————————————————— */

.mb-card {
  background: var(--brand-surface, var(--brand-background));
  border: 1px solid var(--mb-rule);
  border-radius: var(--mb-radius);
  padding: var(--mb-pad);
}
.mb-card--plain { background: var(--brand-background); }
.mb-card--accent {
  background: var(--mb-tint);
  border-color: var(--mb-tint-rule);
}
.mb-card--featured { box-shadow: 0 0 0 2px var(--brand-accent); }
.mb-card-flag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brand-accent);
  margin-bottom: 6px;
}

/* — buttons ——————————————————————————————————————————————— */

.mb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: var(--kit-button-weight, 600);
  font-size: 15px;
  line-height: 1.2;
  padding: var(--kit-button-pad-y, 12px) var(--kit-button-pad-x, 18px);
  border: 1px solid transparent;
  border-radius: var(--kit-radius-button, 6px);
  background: transparent;
  color: var(--brand-text);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.mb-btn--primary { background: var(--brand-accent); color: var(--mb-on-accent); }
.mb-btn--primary:hover { background: color-mix(in srgb, var(--brand-accent) 85%, var(--brand-text)); }
.mb-btn--secondary { border-color: var(--mb-rule); }
.mb-btn--secondary:hover { background: color-mix(in srgb, var(--brand-text) 7%, transparent); }
.mb-btn--ghost { color: var(--brand-accent); padding-inline: 6px; }
.mb-btn--ghost:hover { background: color-mix(in srgb, var(--brand-accent) 10%, transparent); }
.mb-btn--small { font-size: 13px; padding: 7px 12px; }
.mb-btn--block { width: 100%; }
.mb-btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.mb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* — tags —————————————————————————————————————————————————— */

.mb-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 9px;
  border-radius: var(--kit-radius-sm, 4px);
  border: 1px solid var(--mb-rule);
  color: var(--mb-quiet);
}
.mb-tag--accent {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: var(--mb-on-accent);
}
.mb-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* — the "finish your listing" checklist ————————————————————— */

.mb-progress {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-text) 12%, transparent);
  overflow: hidden;
  margin: 14px 0 20px;
}
.mb-progress > span {
  display: block;
  height: 100%;
  background: var(--brand-accent);
  border-radius: inherit;
}
.mb-tasks { list-style: none; margin: 0; padding: 0; }
.mb-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--mb-rule);
}
.mb-task:first-child { border-top: 0; }
.mb-task-tick {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--mb-rule);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}
.mb-task--done .mb-task-tick {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: var(--mb-on-accent);
}
.mb-task-label { flex: 1 1 auto; font-size: 16px; }
.mb-task--done .mb-task-label { text-decoration: line-through; opacity: 0.6; }
.mb-task-cta { font-size: 14px; font-weight: 600; color: var(--brand-accent); text-decoration: none; }
.mb-task--done .mb-task-cta { color: var(--mb-quiet); font-weight: 400; }

/* — the figures panel ——————————————————————————————————————— */

.mb-figures { display: grid; gap: 18px; }
.mb-figure-value {
  font-family: var(--brand-font-heading);
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
}
.mb-figure-label { font-size: 15px; color: var(--mb-quiet); margin-top: 4px; }

/* — the comments switch ————————————————————————————————————— */

.mb-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--mb-rule);
}
.mb-switch {
  flex: 0 0 auto;
  width: 60px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--mb-rule);
  background: color-mix(in srgb, var(--brand-text) 10%, transparent);
  position: relative;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease;
}
.mb-switch[aria-pressed="true"] { background: var(--brand-accent); border-color: var(--brand-accent); }
.mb-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--brand-background);
  transition: transform 0.15s ease;
}
.mb-switch[aria-pressed="true"]::after { transform: translateX(26px); }

/* — the help footer ————————————————————————————————————————— */

.mb-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 4px solid var(--brand-text);
}

/* — notices ——————————————————————————————————————————————— */

.mb-notice {
  margin-top: 18px;
  padding: 14px 16px;
  font-size: 15px;
  border-radius: var(--mb-radius);
  border: 1px solid var(--mb-tint-rule);
  background: var(--mb-tint);
}

.mb-empty { text-align: center; padding: 40px var(--mb-pad); }

/* Nothing here animates under reduced motion: a dashboard is not a place
 * anybody asked for movement. */
@media (prefers-reduced-motion: reduce) {
  .mb-btn, .mb-switch, .mb-switch::after { transition: none; }
}

/* ===================================================================
 * The signup wizard. Same tokens, same component grammar — a business
 * should not be able to tell where joining stops and the dashboard starts.
 * =================================================================== */

.mb--narrow { max-width: 640px; }

.mb-stack { display: flex; flex-direction: column; gap: 22px; }
.mb-inline { display: flex; gap: 10px; flex-wrap: wrap; }
.mb-inline > .mb-input { flex: 1; min-width: 180px; }

.mb-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.mb-steps-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  color: var(--mb-quiet);
}

/* — fields ———————————————————————————————————————————————— */

.mb-field { display: flex; flex-direction: column; gap: 8px; font-size: 17px; }

.mb-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font-family: var(--brand-font-body);
  font-size: 18px;
  color: var(--brand-text);
  caret-color: var(--brand-accent);
  /* The page ground is the surface, so a field reads as a well cut into it
     rather than a panel sitting on it. */
  background: var(--brand-background);
  border: 1px solid var(--mb-rule);
  border-radius: var(--mb-radius);
}
.mb-input--large { min-height: 60px; font-size: 21px; padding: 12px 18px; }
.mb-input::placeholder {
  /* Measured rather than left to the browser's grey, which misses 4.5:1 on
     most grounds. 62% of the ink clears it and still reads as a prompt. */
  color: color-mix(in srgb, var(--brand-text) 62%, transparent);
  opacity: 1;
}
.mb-input:hover { border-color: color-mix(in srgb, var(--brand-text) 45%, transparent); }
.mb-input:focus-visible { border-color: var(--brand-accent); outline-offset: 0; }

.mb-btn--large { min-height: 60px; font-size: 19px; }

/* — a thing you pick ——————————————————————————————————————— */

.mb-pick {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--brand-surface, var(--brand-background));
  border: 2px solid transparent;
  border-radius: var(--mb-radius);
  box-sizing: border-box;
}
.mb-pick:hover,
.mb-pick:focus-visible { border-color: var(--brand-accent); }
.mb-pick[disabled] { cursor: default; opacity: 0.55; }
.mb-pick[disabled]:hover { border-color: transparent; }
.mb-pick--on { border-color: var(--brand-accent); background: var(--mb-tint); }

.mb-pick-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.mb-pick-name {
  font-family: var(--brand-font-heading);
  font-size: 20px;
  font-weight: var(--kit-heading-weight, 600);
}
.mb-pick-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.mb-pick-cta { font-size: 16px; color: var(--brand-accent); white-space: nowrap; }
.mb-pick--radio { align-items: flex-start; }

.mb-radio {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 4px;
  border-radius: 50%;
  border: 2px solid var(--brand-accent);
  background: var(--brand-background);
}
.mb-pick--on .mb-radio {
  background: var(--brand-accent);
  box-shadow: inset 0 0 0 4px var(--brand-background);
}

/* — the done page ————————————————————————————————————————— */

.mb-kicker {
  font-size: 17px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-accent);
}
.mb-numbered { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mb-numbered > li {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 18px;
  padding: 16px 18px;
  background: var(--brand-surface, var(--brand-background));
  border-radius: var(--mb-radius);
}
.mb-numbered b { color: var(--brand-accent); }

/* Alpine hides these until it has initialised; without it every step of the
 * wizard is on screen at once for the first paint.
 *
 * SCOPED, deliberately. As a bare `[x-cloak]` this hid every cloaked
 * element on any page that linked this stylesheet -- and `theme_base.html`
 * does not load Alpine, so nothing ever removed the attribute and the
 * signup wizard rendered as a header, a footer and nothing in between.
 * Scoping it means a page that forgets Alpine shows its content
 * unstyled-but-present rather than blank. */
.mb[x-cloak], .mb [x-cloak] { display: none !important; }

/* ===================================================================
 * For Local Business — the pitch page's own blocks.
 * =================================================================== */

.mb-display {
  font-family: var(--brand-font-heading);
  font-weight: var(--kit-heading-weight, 600);
  letter-spacing: var(--kit-heading-tracking, -0.02em);
  font-size: clamp(38px, 7vw, 84px);
  line-height: 1.0;
  margin: 0;
  text-wrap: balance;
}
.mb-hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 56px;
  align-items: center;
}
/* One column well before the figure gets narrow enough to look like a mistake.
   The headline is the content; the picture is the furniture. */
@media (max-width: 900px) {
  .mb-hero { grid-template-columns: 1fr; gap: 32px; }
  .mb-hero-figure { order: -1; }
}
.mb-hero-lede {
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.45;
  margin: 0;
  max-width: 30em;
  text-wrap: pretty;
}
.mb-hero-figure { margin: 0; aspect-ratio: 4 / 5; border-radius: var(--mb-radius); overflow: hidden; }
.mb-hero-figure img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* — the numbered how-it-works band ——————————————————————————— */

.mb-steps-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 48px;
}
.mb-step-number {
  font-family: var(--brand-font-heading);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 600;
  line-height: 1;
  color: var(--brand-accent);
}

/* — the strapline rule ——————————————————————————————————————
 * A 4px rule over a 1px one with uppercase text between: the masthead device
 * the whole Broadsheet look is named after, and the cheapest way to make a
 * page read as a newspaper rather than a landing page. */
.mb-strapline {
  border-top: 4px solid var(--brand-text);
  border-bottom: 1px solid var(--brand-text);
  margin-bottom: 56px;
  padding: 10px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mb-strapline > :empty { display: none; }
/* The LAST item goes right, whether there are two or three: a blank
 * middle slot used to be the thing pushed, leaving a hole. */
.mb-strapline > :last-child { margin-left: auto; }

/* — halftone ————————————————————————————————————————————————
 * A photograph printed as a newspaper would print it: desaturated, contrast
 * pushed, and a dot screen multiplied over the top. The dots are a CSS
 * gradient rather than an image, so it costs no request and scales with the
 * picture. `isolation` keeps the multiply inside the figure instead of
 * reaching the page behind it. */
.mb-halftone {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  filter: grayscale(0.35) contrast(1.15);
}
.mb-halftone::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* The dot screen is the publication's own ink, not neutral black: on a
   * warm-grey paper a pure-black screen reads as dirt. */
  background-image: radial-gradient(
      circle,
      color-mix(in srgb, var(--brand-text) 22%, transparent) 30%,
      transparent 32%);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}
/* The screen is a print texture, not information. Under reduced motion it is
 * harmless, but at very small sizes it turns into moire, so it is dropped. */
@media (max-width: 480px) {
  .mb-halftone::after { display: none; }
}

/* — a figure beside a column ————————————————————————————————— */

.mb-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 56px;
  align-items: center;
}
@media (max-width: 900px) {
  .mb-split { grid-template-columns: 1fr; gap: 32px; }
}
.mb-figure { margin: 0; border-radius: var(--mb-radius); overflow: hidden; }
.mb-figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mb-figure--portrait { aspect-ratio: 4 / 5; }
.mb-figure--landscape { aspect-ratio: 4 / 3; }

/* — the figures band ————————————————————————————————————————
 * Deliberately not .mb-figure-value's 44px: on the dashboard these sit in a
 * card beside a checklist, and here they are the whole band. */
.mb-numbers {
  display: grid;
  /* `minmax(0, …)` not `1fr` alone: a 1fr track is `minmax(auto, 1fr)` and a
   * long number blows the track out, which is why the design pins it too. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 40px 32px;
  align-items: end;
}
/* The design is three across. `auto-fit` alone would give four at 1180px, and
 * the placement already declares `container-type: inline-size`, so the cap can
 * follow the block's own width rather than the viewport's -- which is what it
 * sits in. Without container-query support the auto-fit above still applies. */
@container (min-width: 760px) {
  .mb-numbers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.mb-number {
  font-family: var(--brand-font-heading);
  font-size: clamp(44px, 6vw, 72px);
  font-weight: 600;
  line-height: 1;
}
.mb-number-label { font-size: 19px; margin-top: 8px; }

/* — the closing call to action ———————————————————————————————— */

.mb-closing {
  border-top: 4px solid var(--brand-text);
  padding-top: 48px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.mb-closing h2 { margin-right: auto; }
