Skip to content
Design system
v1.0
Tier 1, Marathon to the world

Marketing tip cards

Confirmed

Single tip, quote, and stat cards a non-designer can fill without breaking.

Champion r06Confirmed in r06Repo folder build/tips-cards/v/best/
Marketing tip cards, primary render

Primary render. Select it to open full size.

Renders

Every render from the champion round

Showing 40 of 77 renders. The rest are in build/tips-cards/v/best/renders/.

Rules

How to use it, from the piece README

Three cards for the marketing tips pillar: the tip card, the quote card, and the stat card. Two sizes only, 1080x1350 for the feed and 1080x1080 square. You pick, the card does the layout.

Each card says one thing. It holds one main line, printed at 90px or bigger, and one short supporting line under it. That is all the words a card has room for. The tip number, the topic, the stat source, and the logo sit in the footer strip, which nobody edits.

  • Tip: a photo on top and a navy field below, or the whole card navy when no photo fits.
  • Quote: the whole card navy. The opening quote mark is the only red.
  • Stat: white, with the figure as big as it will go. White keeps a feed of tips mostly neutral.

Make a card

  1. Open editor.html in Chrome.
  2. Step 1: pick a card from the library, a size, and a photo. Only Marathon shoots are offered. If no photo fits the tip, pick No photo, and the headline fills the navy card instead.
  3. Step 2: change the words if you need to. Each box shows its count against the limit, and the count turns red with the number of characters to cut once you go over. Main line, 60 characters. Supporting line, 90. Quote, 90. What the number means, 80. Source, 60. If you need more words than that, it is two cards or a carousel.
  4. Step 3: copy the command under the preview and run it from the repo root. It writes the PNG at the exact size. Post that file, never a screenshot of the editor.

The note above the preview tells you what the card did. Green means every word fits whole. Amber means a figure in a library card still needs Jacob. Red means export is blocked: the card is covered with "Not for posting", the note names each field and how many characters to cut, and there is no export command until you fix it.

The card never cuts your words

Nothing on this card is ever shortened for you. No ellipsis, no dropped sentence, no clipped source. If the main line, the supporting line, the quote, the name, the line under the number, or the source is over its limit, or will not fit whole at the smallest type, the card blocks itself instead. A paste twice as long as it should be is kept whole in the box so you can see what to cut. renders/editor-long-blocked.png shows that, and renders/long-copy.png shows copy written right up to every limit printing whole next to copy at twice the length, blocked.

What you cannot change, on purpose

  • Colour, type, spacing, the logo, and the footer. They come from tokens/v/best/tokens.css.
  • Where the words sit. Words never sit on a photo, so a white marble showroom, a dark tree canopy, and a busy rooftop aerial all read the same.
  • Red never touches a photo. Some drone lot shots have a red boundary line burned in, and a red eyebrow or bar on top of it would clash. The photo credit sits on a navy block.
  • The crop. Each photo carries its own focal point in tips.js, so portrait originals crop to the subject without anyone dragging a box.

How it fits long copy

The card tries the biggest layout first, then steps down nine times: type shrinks first, the photo shrinks only after, because the photo is the hero. The main line stops shrinking at 90px, so it always reads as a statement on a phone. If the copy still does not fit at the smallest size, the card blocks export and tells you which line to shorten. It never cuts the copy.

The fitter checks width as well as height. No word may break, so a long street name or a pasted URL counts as too wide, and the card keeps stepping the type down until every word fits whole. "1234 West Sam Houston Parkway North" fits that way. A single word wider than the card even at the smallest type, like a parcel ID or a street typed with no spaces, is never split across lines. The main line is already at its 90px floor by then, so the card blocks export, covers itself with "Not for posting", names the field and the word, and the editor shows no export command. "List Mittelwesthoustonindustrialparkwaydrive fast." blocks. Put the spaces back, "List Mittel West Houston Industrial Parkway fast.", and it prints whole. The same rule holds in every field: a word that fits whole in the smaller supporting line prints, a word that does not fit whole anywhere blocks.

renders/long-word.png shows that on the main line, supporting line, stat label, and quote. renders/editor-longword-blocked.png shows the editor with that word blocked.

Stat figures are never cut

The number and the unit go on the card exactly as you type them. There is no character limit on either, and the card never drops, filters, or rounds a character, because a stat with digits missing is a false stat. $1,250,000 in sales prints as $1,250,000 in sales.

To fit, the card steps the number down 4px at a time until the number sits on one line and the unit sits on one line beside or under it, with no word broken. When the unit goes under the figure it drops a fifth of the figure size clear, so the comma in 1,250 or $1,250,000 never touches it (renders/cards/unit-1250-portrait.png). It stops at a floor, 128px on 1080x1350 and 104px on 1080x1080, because below that a stat stops reading as a stat on a phone. If the figure still does not fit whole at the floor, the card blocks itself:

  • A number too wide, like $1,250,000,000,000. The note offers the same figure written shorter, $1.25T, but never applies it. You own the number.
  • A unit longer than one line. A unit is a word or two, like hrs, leads, or in sales. Anything longer goes in What the number means.
  • A stat with no digits in the number, or no source.
  • A source that runs past two lines in the footer.

renders/stat-figures.png shows $1,250,000, $12,500,000, and 1,000,000+ printing whole at both sizes and on a photo, and the two blocked cases. renders/editor-blocked.png shows the editor with export blocked.

The three cards

CardUse it forFields
TipOne piece of advice a client can act on this weekTip number, topic, photo, main line, supporting line
QuoteA line from Jacob on how Marathon worksQuote, name, role (printed as the supporting line)
StatOne number and what it meansNumber, unit, what it means, source (printed in the footer)

Write tips like Marathon talks: a plain verb first, a real number, a specific time. "Ask for the review by text within 2 hours" beats "Reach out promptly." The main line is the tip. The supporting line is the why or the how, in one sentence. Numerals for time, money, and percentages. No em dashes, the card swaps any pasted em dash for a comma.

Add a tip to the library

Add an entry to MC_CARDS in tips.js, copying an existing one. Give it a short id. If it carries a figure nobody has confirmed, add confirm: 'what to check', and the editor flags it.

Files

FileWhat it is
card.htmlThe card at full size. Takes ?card= plus any field, for example ?card=review-sms&size=square.
editor.htmlThe card maker described above.
card.css, card.jsLayout and the fitter. Tokens only, no hex. Safe in a String.raw template.
tips.jsThe library of cards, photos with focal points and credits, topics, and limits.
icons-inline.jsIcons copied from icons/v/best/icons.svg by build_icons.py. Do not edit.
photos/Copies of the Marathon shoots from brief/real-photos/. Copied, never hotlinked.
render_all.mjs, compose.pyRebuild every render and the contact sheets.
render_editor.mjsScreenshots the editor with a figure that fits, a figure blocked, copy too long, and a word too long.

For Jacob to confirm

  • 48 hours from shoot day to a live Zillow Showcase listing (tip 02 and the 48 hrs stat card).
  • $1,250,000 closed in one quarter (the stat-sales card), and which client it comes from.
  • 5 minutes as the lead response window, and 2 hours for the review request, as Marathon house rules.
  • The two founder quotes are drawn from the brand guide's own lines, cut down for social.
  • marathoncreative.co as the footer address.
Use it

Files to download and code to copy

  • Whole piece, source files22 files, zip, 7.2 MB. Paths inside follow the repo layout, so put tokens.css beside them as the README says.
    Download

Copy-paste code

card.css166 lines, 9.5 KB
/* Marathon tips cards, card.css.
   Every colour, weight, and space comes from tokens.css. A hex typed here is a defect.
   One card says one thing. The field holds a single main line, the headline, the figure, or the
   quote, at 90px or more, and one short supporting line under it. Everything else (tip number,
   topic, source, logo) lives in the footer strip, which nobody edits.
   Type sizes below are ranges, not values. card.js picks the largest size that fits. */

:root { --k: 2; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--mc-surface-muted); }
body { font-family: var(--mc-font); color: var(--mc-text-primary); -webkit-font-smoothing: antialiased; }

/* ---------- Canvas. Exactly two sizes exist. ---------- */
.card {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  font-family: var(--mc-font);
  font-variant-numeric: var(--mc-numeric-tabular);
  /* The field. Navy by default, the strong colour the statement sits on. */
  background: var(--mc-surface-inverse); color: var(--mc-text-inverse);
  --ink: var(--mc-text-inverse); --ink-2: var(--mc-text-inverse-secondary); --ink-3: var(--mc-text-inverse-tertiary);
  --mark: var(--mc-accent-on-inverse); --line: var(--mc-border-inverse);
  --side: var(--mc-social-portrait-safe-side);
  --top-pad: var(--mc-social-portrait-safe-top);
  --gap: calc(var(--mc-space-07) * var(--k));
  /* Ranges the fitter walks, largest first. The main line never goes under 90. */
  --photo-max: 640; --photo-min: 420;
  --head-max: 112; --head-min: 90;
  --sub-max: 40; --sub-min: 34;
  --value-max: 400; --value-min: 220;
  /* The smallest a stat figure may print. Below this it stops reading as a stat at phone size,
     so card.js blocks the card instead of shrinking or cutting the figure. */
  --value-floor: 128;
}
.card.is-portrait { width: var(--mc-social-portrait-w); height: var(--mc-social-portrait-h); }
.card.is-square {
  width: var(--mc-social-square-w); height: var(--mc-social-square-h);
  --side: var(--mc-social-square-safe-side);
  --top-pad: var(--mc-social-square-safe-top);
  --gap: calc(var(--mc-space-06) * var(--k));
  --photo-max: 420; --photo-min: 300;
  --head-max: 100; --head-min: 90;
  --sub-max: 36; --sub-min: 32;
  --value-max: 300; --value-min: 180;
  --value-floor: 104;
}
/* No photo: the whole card is the field, so the line gets bigger. */
.card.is-tip.no-photo { --head-max: 150; --head-min: 96; }
.card.is-square.is-tip.no-photo { --head-max: 124; --head-min: 90; }
.card.is-quote { --head-max: 128; --head-min: 90; }
.card.is-square.is-quote { --head-max: 108; --head-min: 90; }
.card.is-stat.no-photo { --value-max: 560; }
.card.is-square.is-stat.no-photo { --value-max: 400; }

/* Stat cards sit on white, so a feed of tips stays mostly neutral: about 80, 15, 5. */
.card.is-stat {
  background: var(--mc-surface-page); color: var(--mc-text-primary);
  --ink: var(--mc-text-heading); --ink-2: var(--mc-text-secondary); --ink-3: var(--mc-text-tertiary);
  --mark: var(--mc-text-label); --line: var(--mc-border-subtle);
}

/* ---------- Photo. Height is set by the fitter. No word and no red ever sits on it. ---------- */
.top { position: relative; flex: none; height: calc(var(--photo-h, 640) * 1px); background: var(--mc-surface-inverse); overflow: hidden; }
.top img.photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 50%); display: block; }
.credit {
  position: absolute; left: 0; bottom: 0; max-width: calc(100% - var(--side));
  display: flex; align-items: center; gap: calc(var(--mc-space-04) * var(--k));
  padding: calc(var(--mc-space-04) * var(--k)) var(--side);
  background: var(--mc-surface-inverse); color: var(--mc-text-inverse);
  font-size: calc(var(--mc-type-caption-size) * var(--k)); font-weight: var(--mc-weight-semibold);
  line-height: 1.2; white-space: nowrap;
}
.credit .mc-icon { --mc-icon-display-size: calc(var(--mc-space-06) * var(--k)); color: var(--mc-text-inverse); }

/* ---------- The field. One main line, one supporting line. ---------- */
.panel {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: calc(var(--mc-space-10) * var(--k)) var(--side) 0 var(--side);
}
.is-square.has-photo .panel { padding-top: calc(var(--mc-space-08) * var(--k)); }
.no-photo .panel { padding-top: var(--top-pad); }
.copy { flex: 1; min-height: 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
/* Without a photo the statement sits low on the field, where the eye lands after the scroll. */
.no-photo .copy { padding-bottom: calc(var(--mc-space-08) * var(--k)); }
/* Pushed down by an auto margin, not flex-end, so copy that runs long overflows downward where
   the fitter can measure it, never off the top edge. */
.no-photo .copy > :first-child { margin-top: auto; }

/* Long words. Words never break. card.js steps the type down until every word fits whole. If a
   street name, a parcel ID, or a pasted URL with no spaces is still wider than the line at the
   smallest size, the card is blocked, and .may-break only keeps that word inside the card under
   the Not for posting cover. A split word is never an exportable state. */
.copy .main, .copy .sub { overflow-wrap: normal; word-break: normal; min-width: 0; max-width: 100%; }
.card.may-break .copy .main, .card.may-break .copy .sub { overflow-wrap: break-word; }

.main {
  font-size: calc(var(--head) * 1px); font-weight: var(--mc-type-h1-weight);
  line-height: 1.02; letter-spacing: var(--mc-type-h1-tracking); color: var(--ink);
  text-wrap: balance; flex: none;
}
.sub {
  margin-top: var(--gap);
  font-size: calc(var(--sub) * 1px); font-weight: var(--mc-weight-regular);
  line-height: 1.3; color: var(--ink-2); text-wrap: pretty; flex: none;
}
.sub:empty { display: none; }

/* Quote. The opening mark is the one red on the card, Red Bright because it sits on navy. */
.is-quote .main .q { color: var(--mark); }

/* ---------- Stat figure ---------- */
.stat-value {
  flex: none; display: flex; align-items: baseline; flex-wrap: wrap;
  /* When the unit wraps under the figure it drops clear of the comma descenders in 1,250 and
     $1,250,000. The comma hangs about 0.14 of the figure size below the baseline, and the line box
     ends well above that at this line height, so the row gap carries the clearance. */
  gap: calc(var(--mc-space-04) * var(--k)); row-gap: calc(var(--value) * 0.2px);
  color: var(--ink); font-weight: var(--mc-weight-extrabold);
  font-variant-numeric: var(--mc-numeric-tabular); letter-spacing: -0.04em; line-height: 0.86;
}
.stat-value .v { font-size: calc(var(--value) * 1px); white-space: nowrap; }
.stat-value .u { font-size: calc(var(--value) * 0.28px); letter-spacing: var(--mc-type-h1-tracking); line-height: 1; overflow-wrap: normal; min-width: 0; max-width: 100%; }
.is-stat .sub { color: var(--mc-text-heading); font-weight: var(--mc-weight-semibold); }

/* ---------- Footer strip. Same on every card, nobody edits it. ---------- */
.foot {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: calc(var(--mc-space-08) * var(--k));
  height: calc(var(--mc-space-14) + var(--mc-space-05));
  border-top: var(--mc-border-width-hairline) solid var(--line);
}
.is-square .foot { height: calc(var(--mc-space-13) + var(--mc-space-05)); }
.foot img { height: calc(var(--mc-space-08) * 1.6); width: auto; display: block; flex: none; }
.foot .tag {
  min-width: 0; text-align: right;
  font-size: calc(var(--mc-type-eyebrow-size) * var(--k)); font-weight: var(--mc-type-eyebrow-weight);
  letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: uppercase; line-height: 1.35;
  color: var(--ink-3);
}
.foot .tag b { color: var(--mark); font-weight: var(--mc-type-eyebrow-weight); }
.foot .tag.source { text-transform: none; letter-spacing: 0; font-weight: var(--mc-weight-semibold); max-width: 62%;
  overflow-wrap: anywhere; }
/* No clamp and no ellipsis. A source that runs past two lines blocks the card instead. */
.foot .tag.source b { text-transform: uppercase; letter-spacing: var(--mc-type-eyebrow-tracking); margin-right: calc(var(--mc-space-03) * var(--k)); }

/* ---------- Blocked. A stat whose figure cannot fit whole. Covers the whole card. ---------- */
.blocked {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: center;
  padding: 0 var(--side); background: var(--mc-surface-inverse); color: var(--mc-text-inverse);
}
.blocked-eyebrow {
  font-size: calc(var(--mc-type-eyebrow-size) * var(--k)); font-weight: var(--mc-type-eyebrow-weight);
  letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: uppercase; color: var(--mc-accent-on-inverse);
}
.blocked-title {
  margin: calc(var(--mc-space-05) * var(--k)) 0 calc(var(--mc-space-08) * var(--k));
  font-size: 80px; font-weight: var(--mc-type-h1-weight);
  line-height: 1.02; letter-spacing: var(--mc-type-h1-tracking); color: var(--mc-text-inverse); text-wrap: balance;
}
.is-square .blocked-title { font-size: 64px; }
.is-square .blocked-why, .is-square .blocked-fix { font-size: 28px; }
.blocked-why, .blocked-fix {
  font-size: 32px; font-weight: var(--mc-weight-regular); line-height: 1.35; color: var(--mc-text-inverse);
  overflow-wrap: anywhere; margin-bottom: calc(var(--mc-space-04) * var(--k));
}
.blocked-fix { color: var(--mc-text-inverse-secondary); font-weight: var(--mc-weight-semibold); }
card.html31 lines, 1.3 KB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1080">
<title>Marathon tips card</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<link rel="stylesheet" href="../../../icons/v/best/icons.css">
<link rel="stylesheet" href="card.css">
<style>html, body { background: var(--mc-surface-page); } #stage { width: max-content; }</style>
</head>
<body>
<div id="sprite"></div>
<div id="stage"></div>
<script src="icons-inline.js"></script>
<script src="tips.js"></script>
<script src="card.js"></script>
<script>
  // card.html?card=review-sms&size=square&photo=mc_retouched_03
  // Any field can be typed on top: headline, body, quote, name, role, value, unit, label, source, num, topic.
  document.getElementById('sprite').innerHTML = window.MC_ICON_SPRITE;
  var q = new URLSearchParams(location.search), spec = {};
  q.forEach(function (v, k) { spec[k] = v; });
  if (!spec.card && !spec.headline && !spec.quote && !spec.value) spec.card = 'zillow-showcase';
  var el = MC_buildCard(spec);
  document.getElementById('stage').appendChild(el);
  document.fonts.ready.then(function () { window.MC_FIT = MC_fitCard(el); document.body.dataset.fit = el.dataset.fit; document.body.dataset.ready = '1'; });
</script>
</body>
</html>
editor.html119 lines, 9.4 KB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Marathon tips card maker</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<link rel="stylesheet" href="../../../icons/v/best/icons.css">
<link rel="stylesheet" href="card.css">
<style>
  body { background: var(--mc-surface-muted); margin: 0; }
  .bar { background: var(--mc-surface-inverse); color: var(--mc-text-inverse); display: flex; align-items: center; gap: var(--mc-space-05); padding: var(--mc-space-05) var(--mc-screen-margin); }
  .bar img { height: 26px; }
  .bar span { font-size: var(--mc-type-appname-size); font-weight: var(--mc-type-appname-weight); letter-spacing: var(--mc-type-appname-tracking); text-transform: uppercase; color: var(--mc-text-inverse-secondary); border-left: 1px solid var(--mc-border-inverse); padding-left: var(--mc-space-05); }
  .wrap { display: grid; gap: var(--mc-space-08); padding: var(--mc-space-08) var(--mc-screen-margin); grid-template-columns: 1fr; }
  @media (min-width: 960px) { .wrap { grid-template-columns: 380px 1fr; } }
  .wrap > * { min-width: 0; }
  .stage { max-width: 560px; }
  form { display: grid; gap: var(--mc-space-05); align-content: start; }
  label { display: grid; gap: var(--mc-space-02); font-size: var(--mc-type-small-size); font-weight: var(--mc-weight-semibold); color: var(--mc-text-heading); }
  label small.over { color: var(--mc-status-error); font-weight: var(--mc-weight-semibold); }
  label small { font-weight: var(--mc-weight-regular); color: var(--mc-text-tertiary); }
  select, input, textarea { font: inherit; font-weight: var(--mc-weight-regular); font-size: var(--mc-type-body-size); padding: var(--mc-space-03) var(--mc-space-04); border: 1px solid var(--mc-border-strong); border-radius: var(--mc-radius-md); background: var(--mc-surface-page); color: var(--mc-text-primary); min-height: var(--mc-screen-touch-target); width: 100%; box-sizing: border-box; }
  textarea { min-height: 96px; resize: vertical; }
  .eyebrow-ui { font-size: var(--mc-type-eyebrow-size); font-weight: var(--mc-type-eyebrow-weight); letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: uppercase; color: var(--mc-text-label); }
  .hidden { display: none !important; }
  .stage { overflow: hidden; }
  .scaler { transform-origin: top left; }
  .status { font-size: var(--mc-type-small-size); padding: var(--mc-space-04) var(--mc-space-05); border-radius: var(--mc-radius-md); background: var(--mc-surface-page); border-left: 3px solid var(--mc-status-success); margin-bottom: var(--mc-space-05); color: var(--mc-text-primary); }
  .status.warn { border-left-color: var(--mc-status-warning); }
  .status.block { border-left-color: var(--mc-status-error); background: var(--mc-status-error-surface); font-weight: var(--mc-weight-semibold); }
  code.is-blocked { color: var(--mc-text-disabled); }
  code { display: block; white-space: pre-wrap; word-break: break-all; font-size: var(--mc-type-caption-size); background: var(--mc-surface-page); border: 1px solid var(--mc-border-subtle); padding: var(--mc-space-04); border-radius: var(--mc-radius-md); color: var(--mc-text-secondary); }
</style>
</head>
<body>
<div id="sprite"></div>
<header class="bar"><img src="../../../tokens/v/best/logos/marathon-logo-white.svg" alt="Marathon Creative"><span>Tips card maker</span></header>
<div class="wrap">
  <form id="f" autocomplete="off">
    <div class="eyebrow-ui">Step 1, pick a card</div>
    <label>Start from the library <select name="card" id="card"></select></label>
    <label>Size <select name="size"><option value="portrait">1080x1350, feed</option><option value="square">1080x1080, square</option></select></label>
    <label class="for-tip for-stat">Photo <small>Only Marathon shoots. Leave on No photo if none fits.</small><select name="photo" id="photo"></select></label>
    <label class="for-tip for-stat">Topic <select name="topic" id="topic"></select></label>
    <div class="eyebrow-ui">Step 2, change the words if you need to</div>
    <label class="for-tip">Tip number <input name="num" maxlength="2" inputmode="numeric"></label>
    <label class="for-tip">Main line <small>One thing, said big. Plain verb first.</small><small data-count="headline"></small><textarea name="headline" rows="2"></textarea></label>
    <label class="for-tip">Supporting line <small>One short sentence, the why or the how.</small><small data-count="body"></small><textarea name="body" rows="2"></textarea></label>
    <label class="for-quote">Quote <small data-count="quote"></small><textarea name="quote" rows="4"></textarea></label>
    <label class="for-quote">Name <input name="name"></label>
    <label class="for-quote">Role <input name="role"></label>
    <label class="for-stat">Number <small>Type it exactly as it should post, for example 48, 1,250, or $1,250,000. The card never cuts it.</small><input name="value" inputmode="decimal"></label>
    <label class="for-stat">Unit <small>A word or two, for example hrs, min, %, leads, or in sales</small><input name="unit"></label>
    <label class="for-stat">What the number means <small>One short line.</small><small data-count="label"></small><textarea name="label"></textarea></label>
    <label class="for-stat">Source <small>Required. Where the number comes from. Prints in the footer.</small><input name="source"></label>
  </form>
  <section>
    <div id="status" class="status"></div>
    <div class="stage" id="stage"><div class="scaler" id="scaler"></div></div>
    <p class="eyebrow-ui">Step 3, export at full size</p>
    <code id="cmd"></code>
  </section>
</div>
<script src="icons-inline.js"></script>
<script src="tips.js"></script>
<script src="card.js"></script>
<script>
  document.getElementById('sprite').innerHTML = window.MC_ICON_SPRITE;
  var f = document.getElementById('f'), L = window.MC_LIMITS;
  function opt(sel, v, t) { var o = document.createElement('option'); o.value = v; o.textContent = t; sel.appendChild(o); }
  Object.keys(MC_CARDS).forEach(function (k) { var c = MC_CARDS[k]; opt(f.card, k, c.type.toUpperCase() + ', ' + (c.headline || c.quote || c.label).slice(0, 48)); });
  opt(f.photo, 'none', 'No photo');
  Object.keys(MC_PHOTOS).forEach(function (k) { opt(f.photo, k, MC_PHOTOS[k].credit + ' (' + MC_PHOTOS[k].kind + ')'); });
  Object.keys(MC_TOPICS).forEach(function (k) { opt(f.topic, k, MC_TOPICS[k]); });
  // No maxlength on purpose. A paste over the limit is kept whole, counted in red, and blocks export,
  // so nothing is ever cut without the person seeing it.

  function load() {
    var c = MC_CARDS[f.card.value];
    ['photo', 'topic', 'num', 'headline', 'body', 'quote', 'name', 'role', 'value', 'unit', 'label', 'source'].forEach(function (k) { if (f[k]) f[k].value = c[k] || (k === 'photo' ? 'none' : (f[k].tagName === 'SELECT' ? f[k].value : '')); });
    draw();
  }
  function spec() {
    var s = { card: f.card.value };
    Array.prototype.forEach.call(f.elements, function (e) { if (e.name && e.value !== '') s[e.name] = e.value; });
    return s;
  }
  function draw() {
    var s = spec(), type = MC_CARDS[s.card].type;
    document.querySelectorAll('[class*="for-"]').forEach(function (n) { n.classList.toggle('hidden', !n.classList.contains('for-' + type)); });
    document.querySelectorAll('[data-count]').forEach(function (n) { var k = n.dataset.count, c = f[k].value.length; n.textContent = c + ' of ' + L[k] + ' characters' + (c > L[k] ? ', cut ' + (c - L[k]) : ''); n.classList.toggle('over', c > L[k]); });
    var sc = document.getElementById('scaler'); sc.innerHTML = '';
    var el = MC_buildCard(s); sc.appendChild(el);
    var w = document.getElementById('stage').clientWidth, k = Math.min(1, w / 1080);
    sc.style.transform = 'scale(' + k + ')';
    document.getElementById('stage').style.height = (el.offsetHeight * k) + 'px';
    var r = MC_fitCard(el), st = document.getElementById('status');
    var msg = 'Fits. Every word prints whole.';
    if (type === 'stat' && r.figure && !r.blocked.length) msg = 'Fits. The figure ' + r.figure.value + (r.figure.unit ? ' ' + r.figure.unit : '') + ' prints whole at ' + r.figure.size + 'px.' + msg.replace('Fits.', '');
    if (MC_CARDS[s.card].confirm) msg += ' Figure to confirm with Jacob: ' + MC_CARDS[s.card].confirm + '.';
    var blocked = !!(r.blocked && r.blocked.length), cmd = document.getElementById('cmd');
    if (blocked) msg = 'Export blocked. ' + r.blocked.join(' ') + (r.suggest ? ' Try ' + r.suggest + ' instead.' : r.why === 'unit' ? ' Move the extra words into What the number means.' : '');
    st.textContent = msg;
    st.classList.toggle('block', blocked);
    st.classList.toggle('warn', !blocked && !!(r.trimmed.length || msg.indexOf('Jacob') >= 0));
    var q = new URLSearchParams(s).toString();
    cmd.classList.toggle('is-blocked', blocked);
    cmd.textContent = blocked ? 'No export command until every word fits whole. The card never cuts your words or your figure.'
      : 'node build/_shared/render.mjs png \'build/tips-cards/v/best/card.html?' + q + '\' ' + s.card + '.png 1080 ' + (s.size === 'square' ? 1080 : 1350) + ' 0';
  }
  f.card.addEventListener('change', load);
  f.addEventListener('input', function (e) { if (e.target !== f.card) draw(); });
  window.addEventListener('resize', draw);
  document.fonts.ready.then(load);
</script>
</body>
</html>
card.js260 lines, 16.3 KB
// Marathon tips cards, card.js. Builds one card from a spec and fits it.
// No framework, no build step. Safe to paste into a String.raw template: no backticks, no dollar-brace.
// Use: MC_buildCard(spec) returns a card element. MC_fitCard(el) fits it and returns a report.
(function () {
  var LOGO_DARK = '../../../tokens/v/best/logos/marathon-logo-dark.svg';
  var LOGO_WHITE = '../../../tokens/v/best/logos/marathon-logo-white.svg';
  var URL_LINE = 'marathoncreative.co';
  var FIELDS = ['type', 'size', 'photo', 'num', 'topic', 'headline', 'body', 'quote', 'name', 'role', 'value', 'unit', 'label', 'source'];

  function esc(s) { return String(s == null ? '' : s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); }
  function clean(s) { return String(s == null ? '' : s).replace(/\s*\u2014\s*/g, ', ').replace(/\s+/g, ' ').trim(); }
  // Limits are checked, never applied. The card does not cut a word, add an ellipsis, or drop a
  // sentence. Copy over its limit, or copy that cannot fit whole at the smallest size, blocks the
  // card instead, and the note names the field and how many characters to cut.
  function icon(name, cls) {
    if (!window.MC_TOPICS || !window.MC_TOPICS[name]) name = 'strategy';
    return '<svg class="mc-icon mc-icon--display ' + (cls || '') + '" aria-hidden="true"><use href="#mc-icon-' + name + '"></use></svg>';
  }

  // Resolve a spec: library card first, then any field typed on top, then limits.
  function resolve(input) {
    var base = {}, lib = window.MC_CARDS || {}, L = window.MC_LIMITS || {};
    if (input.card && lib[input.card]) { var c = lib[input.card]; for (var k in c) base[k] = c[k]; }
    FIELDS.forEach(function (f) { if (input[f] != null && input[f] !== '') base[f] = input[f]; });
    base.type = ['tip', 'quote', 'stat'].indexOf(base.type) >= 0 ? base.type : 'tip';
    base.size = base.size === 'square' ? 'square' : 'portrait';
    if (!base.photo || !(window.MC_PHOTOS || {})[base.photo]) base.photo = 'none';
    if (base.type === 'quote') base.photo = 'none';
    base.num = String(base.num || '').replace(/[^0-9]/g, '').slice(0, 2);
    if (base.num.length === 1) base.num = '0' + base.num;
    base._over = [];
    var used = { tip: ['headline', 'body'], quote: ['quote', 'name', 'role'], stat: ['label', 'source'] }[base.type];
    ['headline', 'body', 'quote', 'name', 'role', 'label', 'source'].forEach(function (f) {
      base[f] = clean(base[f]);
      if (used.indexOf(f) >= 0 && L[f] && base[f].length > L[f]) base._over.push({ field: f, len: base[f].length, limit: L[f] });
    });
    // The figure is never cut, filtered, or rounded. A stat that posts with characters missing
    // is a false stat. The value and the unit go on the card exactly as typed, and fit() steps
    // the type down until they fit whole, or blocks export if they cannot.
    base.value = clean(base.value);
    base.unit = clean(base.unit);
    return base;
  }

  function topBlock(s) {
    if (s.photo === 'none') return '';
    var p = window.MC_PHOTOS[s.photo];
    return '<div class="top" style="--focus:' + esc(p.focus) + '">' +
      '<img class="photo" src="photos/' + esc(s.photo) + '.jpg" alt="' + esc(p.credit) + '">' +
      '<div class="credit">' + icon('photography') + '<span>' + esc(p.credit) + '</span></div></div>';
  }

  // The footer strip carries everything that is not the statement: logo, tip number and topic,
  // or the stat source. Nobody edits its layout.
  function foot(s, topic) {
    var logo = s.type === 'stat' ? LOGO_DARK : LOGO_WHITE, tag;
    if (s.type === 'tip') tag = '<span class="tag"><b>Tip ' + esc(s.num || '01') + '</b> / ' + esc(topic) + '</span>';
    else if (s.type === 'quote') tag = '<span class="tag">' + URL_LINE + '</span>';
    else tag = '<span class="tag source"><b>Source</b>' + esc(s.source) + '</span>';
    return '<div class="foot"><img src="' + logo + '" alt="Marathon Creative">' + tag + '</div>';
  }

  function build(input) {
    var s = resolve(input);
    var el = document.createElement('div');
    el.className = 'card is-' + s.size + ' is-' + s.type + (s.photo !== 'none' ? ' has-photo' : ' no-photo');
    var topic = (window.MC_TOPICS || {})[s.topic] || 'Strategy';
    var copy = '';
    if (s.type === 'tip') {
      copy = '<h1 class="main">' + esc(s.headline) + '</h1><p class="sub">' + esc(s.body) + '</p>';
    } else if (s.type === 'stat') {
      copy = '<div class="stat-value"><span class="v">' + esc(s.value) + '</span>' + (s.unit ? '<span class="u">' + esc(s.unit) + '</span>' : '') + '</div>' +
        '<p class="sub">' + esc(s.label) + '</p>';
    } else {
      copy = '<blockquote class="main"><span class="q" aria-hidden="true">“</span>' + esc(s.quote) + '</blockquote>' +
        '<p class="sub">' + esc([s.name, s.role].filter(Boolean).join(', ')) + '</p>';
    }
    el.innerHTML = topBlock(s) + '<div class="panel"><div class="copy">' + copy + '</div>' + foot(s, topic) + '</div>';
    el._spec = s;
    return el;
  }

  var NAMES = { headline: 'main line', body: 'supporting line', quote: 'quote', name: 'name', role: 'role', label: 'line under the number', source: 'source' };

  function num(el, name) { return parseFloat(getComputedStyle(el).getPropertyValue(name)) || 0; }
  function lerp(a, b, t) { return Math.round(a + (b - a) * t); }

  // Walk from the largest layout to the smallest. Type gives ground first, because the photo is
  // the hero. The photo only shrinks once the copy is already at its middle size.
  var LADDER = [[0, 0], [0, 1], [0, 2], [1, 2], [1, 3], [2, 3], [2, 4], [3, 4], [4, 4]];

  function fit(el) {
    var s = el._spec, copy = el.querySelector('.copy'), body = el.querySelector('.sub'), main = el.querySelector('.main');
    var R = {};
    ['photo', 'head', 'sub', 'value'].forEach(function (k) { R[k] = [num(el, '--' + k + '-max'), num(el, '--' + k + '-min')]; });
    R.floor = num(el, '--value-floor');
    var report = { level: 0, trimmed: [], fits: true, blocked: [] };

    function apply(p, t) {
      el.style.setProperty('--photo-h', lerp(R.photo[0], R.photo[1], p / 4));
      ['head', 'sub'].forEach(function (k) { el.style.setProperty('--' + k, lerp(R[k][0], R[k][1], t / 4)); });
      if (el.querySelector('.stat-value')) fitValue(lerp(R.value[0], R.value[1], t / 4));
    }
    // The stat figure. Start from the size the ladder asks for, then step down 4px at a time
    // until the number and the unit each sit on one line, with no word broken. A unit is a
    // word or two, not a sentence; anything longer belongs in What the number means. The smallest size allowed is --value-floor. Below that the figure is not a stat
    // any more, so the card is blocked instead of shrunk further or cut.
    function figureFits() {
      var vv = el.querySelector('.stat-value .v'), u = el.querySelector('.stat-value .u'), cw = copy.clientWidth;
      R.valueWhy = 'value';
      // Layout sizes, not screen rects, so the answer is the same inside the scaled editor preview.
      if (vv.offsetWidth > cw + 1) return false;
      if (!u) return true;
      var lh = parseFloat(getComputedStyle(u).lineHeight) || 1;
      R.valueWhy = 'unit';
      return u.scrollWidth <= u.clientWidth + 1 && u.offsetWidth <= cw + 1 && u.offsetHeight <= lh + 2;
    }
    function fitValue(start) {
      var size = start;
      el.style.setProperty('--value', size);
      while (!figureFits() && size - 4 >= R.floor) { size -= 4; el.style.setProperty('--value', size); }
      R.valueSize = size; R.valueFits = figureFits();
    }
    // Height check: the copy column holds every line.
    function tall() { return copy.scrollHeight > copy.clientHeight + 1; }
    // Width check: no line runs past the right edge. While measuring, words are not allowed to
    // break, so a long street name or a pasted URL shows up as overflow instead of hiding.
    function wide() {
      if (el.querySelector('.stat-value') && !R.valueFits) return false; // judged on its own, below
      if (copy.scrollWidth > copy.clientWidth + 1) return true;
      // A word wider than the line overflows its own block before it shows on the column.
      // scrollWidth does not always report it, so measure the widest word itself. Once a word has
      // been allowed to break, it no longer counts as too wide.
      if (R.allowBreak) return false;
      return ['.main', '.sub'].some(function (q) { var n = el.querySelector(q); return n && widestWord(n) > n.clientWidth + 1; });
    }
    function widestWord(n) {
      var probe = document.createElement('span'), cs = getComputedStyle(n), max = 0;
      probe.style.cssText = 'position:absolute;visibility:hidden;white-space:nowrap;left:0;top:0';
      ['fontFamily', 'fontSize', 'fontWeight', 'letterSpacing', 'fontVariantNumeric'].forEach(function (k) { probe.style[k] = cs[k]; });
      el.appendChild(probe);
      n.textContent.split(/\s+/).forEach(function (w) { probe.textContent = w; max = Math.max(max, probe.getBoundingClientRect().width / (el.getBoundingClientRect().width / el.offsetWidth || 1)); });
      el.removeChild(probe);
      return max;
    }
    function fits() { return !tall() && !wide(); }
    // Every word that is wider than its own line at the current size, with the field it sits in.
    function longWords() {
      var out = [];
      [['.main', s.type === 'quote' ? 'quote' : s.type === 'stat' ? 'label' : 'headline'],
       ['.sub', s.type === 'stat' ? 'label' : s.type === 'quote' ? 'name' : 'body']].forEach(function (q) {
        var n = el.querySelector(q[0]); if (!n) return;
        var probe = document.createElement('span'), cs = getComputedStyle(n), k = el.getBoundingClientRect().width / el.offsetWidth || 1;
        probe.style.cssText = 'position:absolute;visibility:hidden;white-space:nowrap;left:0;top:0';
        ['fontFamily', 'fontSize', 'fontWeight', 'letterSpacing', 'fontVariantNumeric'].forEach(function (p) { probe.style[p] = cs[p]; });
        el.appendChild(probe);
        n.textContent.split(/\s+/).forEach(function (w) {
          if (!w) return; probe.textContent = w;
          if (probe.getBoundingClientRect().width / k > n.clientWidth + 1) out.push({ field: q[1], word: w, size: Math.round(parseFloat(cs.fontSize)) });
        });
        el.removeChild(probe);
      });
      return out;
    }
    function wideFields() {
      var out = [];
      ['main', 'sub'].forEach(function (c) {
        var n = el.querySelector('.' + c); if (!n) return;
        var r = n.getBoundingClientRect(), cr = copy.getBoundingClientRect();
        if (widestWord(n) > n.clientWidth + 1 || r.right > cr.right + 1) out.push(c === 'main' ? (s.type === 'quote' ? 'quote' : 'headline') : (s.type === 'stat' ? 'label' : s.type === 'quote' ? 'name' : 'supporting line'));
      });
      return out;
    }

    // Pass 1: whole words only. Step type and photo down until height and width both fit.
    el.classList.add('is-measuring');
    var i;
    for (i = 0; i < LADDER.length; i++) { apply(LADDER[i][0], LADDER[i][1]); if (fits()) break; }
    report.broke = []; report.longWords = [];
    if (i >= LADDER.length) { apply(4, 4); report.longWords = longWords(); }
    if (report.longWords.length) {
      // A single word is wider than the column even at the smallest type, so the main line
      // is already at its 90px floor and the word still cannot print whole. Splitting it mid
      // word with no hyphen is not a card anyone may post, so this blocks export. The word is
      // allowed to break only under the block cover, so nothing runs off the edge behind it.
      report.broke = wideFields();
      R.allowBreak = true; el.classList.add('may-break');
      i = LADDER.length - 1;
    }
    el.classList.remove('is-measuring');
    report.level = Math.min(i, LADDER.length - 1);
    report.fits = fits();
    // Words over their limit block the card. Nothing is cut to make them fit.
    s._over.forEach(function (o) {
      report.blocked.push('The ' + NAMES[o.field] + ' is ' + o.len + ' characters. The limit is ' + o.limit + ', so cut ' + (o.len - o.limit) + '.');
    });
    // A word that cannot print whole at the smallest size blocks the card. It is never split.
    report.longWords.forEach(function (w) {
      report.blocked.push('The ' + NAMES[w.field] + ' has a word too long to print whole, even at ' + w.size + 'px: "' + w.word + '". Put the spaces back or shorten it, for example "1234 W Sam Houston Pkwy N".');
    });
    if (report.longWords.length) report.why = 'word';
    // Copy inside its limits that still does not fit whole at the smallest size also blocks.
    if (!report.fits && !s._over.length && !report.longWords.length) report.blocked.push(s.type === 'stat'
      ? 'What the number means does not fit whole at the smallest size. Shorten it.'
      : 'The ' + NAMES[s.type === 'quote' ? 'quote' : 'headline'] + ' and the ' + NAMES[s.type === 'quote' ? 'name' : 'body'] + ' do not fit whole together at the smallest size. Shorten either one.');
    // The source prints whole in the footer, two lines at most.
    var src = el.querySelector('.foot .tag.source');
    if (src && s.source && !s._over.some(function (o) { return o.field === 'source'; }) && src.offsetHeight > parseFloat(getComputedStyle(src).lineHeight) * 2 + 2) report.blocked.push('The source runs past two lines in the footer. Shorten it.');
    if (s.type === 'stat') {
      // The figure decides whether this card may be posted at all.
      if (!/[0-9]/.test(s.value)) report.blocked.push('The number box has no digits in it.');
      else if (!R.valueFits && R.valueWhy === 'value') report.blocked.push('The number ' + s.value + ' is too wide to print whole, even at the smallest size the card allows.');
      else if (!R.valueFits) report.blocked.push('The unit "' + s.unit + '" runs past one line. A unit is a word or two.');
      if (!s.source) report.blocked.push('The stat has no source.');
      report.figure = { value: s.value, unit: s.unit, size: R.valueSize, floor: R.floor };
      if (!R.valueFits) report.why = R.valueWhy;
      if (!R.valueFits && R.valueWhy === 'value' && /[0-9]/.test(s.value)) report.suggest = shorter(s.value);
    }
    el.dataset.fit = report.blocked.length ? 'blocked' : report.fits ? (report.trimmed.length ? 'trimmed' : 'ok') : 'overflow';
    if (report.blocked.length) block(el, report);
    return report;
  }

  // A shorter way to write the same figure, offered as a suggestion only. The card never applies
  // it, because the person posting the stat owns the number.
  function shorter(v) {
    var m = String(v).match(/^([^0-9]*)([0-9][0-9,]*(?:\.[0-9]+)?)(.*)$/); if (!m) return '';
    var n = parseFloat(m[2].replace(/,/g, '')); if (!(n >= 1000)) return '';
    var tiers = [[1e12, 'T'], [1e9, 'B'], [1e6, 'M'], [1e3, 'K']];
    for (var i = 0; i < tiers.length; i++) if (n >= tiers[i][0]) {
      var x = n / tiers[i][0], t = String(Math.round(x * 100) / 100);
      return (Math.round(x * 100) / 100 === x ? m[1] + t + tiers[i][1] + m[3] : '');
    }
    return '';
  }

  // Blocked. The card is covered edge to edge so a screenshot or an export of it cannot be posted.
  function block(el, report) {
    var b = document.createElement('div');
    b.className = 'blocked';
    b.innerHTML = '<div class="blocked-eyebrow">Not for posting</div>' +
      '<p class="blocked-title">This card cannot be exported yet.</p>' +
      report.blocked.map(function (r) { return '<p class="blocked-why">' + esc(r) + '</p>'; }).join('') +
      '<p class="blocked-fix">' + (report.suggest
        ? 'Write the same figure shorter, for example ' + esc(report.suggest) + '. The card will not cut a figure for you.'
        : report.why === 'unit'
          ? 'Keep the unit to a word or two and move the rest into What the number means.'
          : report.why === 'word'
            ? 'The card never splits a word across lines. Add the spaces back and it posts.'
          : report.why === 'value'
            ? 'Shorten the number or the unit. The card will not cut a figure for you.'
            : 'The card never cuts your words to make them fit. Shorten them and it posts.') + '</p>';
    el.appendChild(b);
  }

  window.MC_buildCard = build;
  window.MC_fitCard = fit;
  window.MC_resolveCard = resolve;
})();
icons-inline.js3 lines, 2.8 KB
// GENERATED by build_icons.py from ../../../icons/v/best/icons.svg. Do not edit.
window.MC_ICON_SPRITE = "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"display:none\"><symbol id=\"mc-icon-photography\" viewBox=\"0 0 24 24\"><title>Photography</title><path d=\"M3 9a2 2 0 0 1 2-2h3l1.5-3h5L16 7h3a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/><circle cx=\"12\" cy=\"13.5\" r=\"3.5\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M17.5 10.5h1\"/></symbol><symbol id=\"mc-icon-tour-3d\" viewBox=\"0 0 24 24\"><title>3D tours</title><path d=\"M12 3l8.5 4.5v9.5L12 21.5 3.5 17V7.5z\"/><path d=\"M3.5 7.5L12 12l8.5-4.5M12 12v9.5\"/></symbol><symbol id=\"mc-icon-email-sms\" viewBox=\"0 0 24 24\"><title>Email and SMS</title><path d=\"M12 15H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2v2\"/><path d=\"M2.8 4.2L10.5 10l7.7-5.8\"/><rect x=\"14\" y=\"9\" width=\"7\" height=\"12\" rx=\"2\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M17 18h1\"/></symbol><symbol id=\"mc-icon-drone\" viewBox=\"0 0 24 24\"><title>Drone and aerial</title><path d=\"M2 6h7M15 6h7\"/><path d=\"M5.5 6v3h13V6\"/><path d=\"M8.5 9v3a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2V9\"/><circle cx=\"12\" cy=\"19\" r=\"2\"/></symbol><symbol id=\"mc-icon-crm\" viewBox=\"0 0 24 24\"><title>CRM and automation</title><rect x=\"3\" y=\"3\" width=\"6\" height=\"6\" rx=\"1\"/><circle cx=\"18\" cy=\"6\" r=\"3\"/><rect x=\"15\" y=\"15\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M9 6h6M18 9v6M6 9v9h9\"/></symbol><symbol id=\"mc-icon-strategy\" viewBox=\"0 0 24 24\"><title>Marketing strategy</title><circle cx=\"5.5\" cy=\"18\" r=\"2.5\"/><path d=\"M8 18h7a3 3 0 0 0 0-6H9a3 3 0 0 1 0-6h7\"/><circle cx=\"18.5\" cy=\"6\" r=\"2.5\"/></symbol><symbol id=\"mc-icon-social\" viewBox=\"0 0 24 24\"><title>Social management</title><path d=\"M6 3h12a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-7l-5 4.5V16a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M12 12.5L9.2 9.8a1.75 1.75 0 0 1 2.8-2.1 1.75 1.75 0 0 1 2.8 2.1z\"/></symbol><symbol id=\"mc-icon-paid-ads\" viewBox=\"0 0 24 24\"><title>Paid advertising</title><path d=\"M3 9h5l9-5v16l-9-5H3z\"/><path d=\"M7 15l1.5 5.5h3L10 15.5\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M20.5 9.5v5\"/></symbol><symbol id=\"mc-icon-print-signage\" viewBox=\"0 0 24 24\"><title>Print and signage</title><path d=\"M4 3v18M2 21h5M4 5h16\"/><path d=\"M8 5v3M16 5v3\"/><rect x=\"6\" y=\"8\" width=\"12\" height=\"8\" rx=\"2\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M9 12h6\"/></symbol><symbol id=\"mc-icon-video\" viewBox=\"0 0 24 24\"><title>Videography and post</title><rect x=\"2\" y=\"6\" width=\"13\" height=\"12\" rx=\"2\"/><path d=\"M15 10l6-3v10l-6-3\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M5.5 9.5h2\"/></symbol></svg>";
tips.js108 lines, 5.2 KB
// Marathon tips cards, the content library.
// A team member picks a card by id (card.html?card=review-sms) and only types copy when the
// library does not already have it. Figures marked confirm: true are working numbers for Jacob.

// The only photos a card can use. Each carries its focal point and its credit line, so nobody
// has to crop by hand and the credit is never typed wrong.
window.MC_PHOTOS = {
  'mc_retouched_03': { kind: 'interior', focus: '50% 58%', credit: 'Cangelosi showroom, Houston' },
  'mc_retouched_05': { kind: 'interior', focus: '50% 62%', credit: 'Cangelosi showroom, Houston' },
  'mc_retouched_06': { kind: 'interior', focus: '50% 45%', credit: 'Slab detail, Cangelosi' },
  'mc_retouched_01': { kind: 'interior', focus: '50% 42%', credit: 'The Cangelosi team, Houston' },
  'mc_retouched_07': { kind: 'portrait', focus: '50% 38%', credit: 'Quarry print, Cangelosi showroom' },
  'mc_retouched_08': { kind: 'portrait', focus: '50% 40%', credit: 'Sample racks, Cangelosi showroom' },
  'mc_rosehill_18': { kind: 'portrait', focus: '50% 55%', credit: 'Rosehill Reserve, aerial' },
  'mc_rosehill_16': { kind: 'aerial', focus: '50% 58%', credit: 'Rosehill Reserve, aerial' },
  'mc_rosehill_17': { kind: 'aerial', focus: '50% 62%', credit: 'Rosehill Reserve entry' },
  'mc_fullres_11': { kind: 'aerial', focus: '50% 52%', credit: 'Wooded lot listing, drone' },
  'mc_fullres_12': { kind: 'aerial', focus: '46% 52%', credit: 'Golf course lot listing, drone' }
};

// The topic icons a tip may carry. Nothing else is offered.
window.MC_TOPICS = {
  photography: 'Photography', 'tour-3d': '3D tours', drone: 'Drone', 'email-sms': 'Email and SMS',
  crm: 'PaceCRM', strategy: 'Strategy', social: 'Social', 'paid-ads': 'Paid ads',
  'print-signage': 'Print', video: 'Video'
};

// Hard limits on the words. One card says one thing: a main line people read from across the
// room, and one supporting line. Nothing is ever cut to fit. Copy over its limit blocks the
// card, and the editor names the field and how many characters to cut. The stat number and unit
// have no character limit: card.js fits them by type size and blocks the card if they cannot fit whole.
window.MC_LIMITS = {
  headline: 60, body: 90, quote: 90, name: 24, role: 40,
  label: 80, source: 60
};

window.MC_CARDS = {
  'photo-timing': {
    type: 'tip', num: '01', topic: 'photography', photo: 'mc_rosehill_17',
    headline: 'Shoot exteriors in the first 2 hours of light.',
    body: 'Midday sun flattens the facade and blows out the windows.'
  },
  'zillow-showcase': {
    type: 'tip', num: '02', topic: 'tour-3d', photo: 'mc_retouched_03',
    headline: 'Photos, 3D tour, and floor plan in one visit.',
    body: 'That is a Zillow Showcase listing, live in 48 hours.',
    confirm: '48 hour turnaround'
  },
  'review-sms': {
    type: 'tip', num: '03', topic: 'email-sms', photo: 'none',
    headline: 'Ask for the review by text within 2 hours.',
    body: 'First name at the top, the link in the message. Emails sit unopened.'
  },
  'lot-line': {
    type: 'tip', num: '04', topic: 'drone', photo: 'mc_fullres_12',
    headline: 'Draw the lot line on the drone shot.',
    body: 'Buyers cannot see a boundary from the road. Fly it at 200 feet.'
  },
  'speed-to-lead': {
    type: 'tip', num: '05', topic: 'crm', photo: 'none',
    headline: 'Answer every new lead inside 5 minutes.',
    body: 'PaceCRM texts back the moment the form lands. A person closes it.'
  },
  'roof-before': {
    type: 'tip', num: '06', topic: 'photography', photo: 'none',
    headline: 'Photograph the roof before the first shingle comes off.',
    body: 'It protects the claim, and the before and after is next month’s post.'
  },
  'quote-thinks-first': {
    type: 'quote',
    quote: 'Most agencies execute. We think first.',
    name: 'Jacob Dow', role: 'Founder, Marathon Creative'
  },
  'quote-long-game': {
    type: 'quote',
    quote: 'We build the systems clients run on, then we keep running them.',
    name: 'Jacob Dow', role: 'Founder, Marathon Creative'
  },
  'stat-lead-window': {
    type: 'stat', topic: 'crm', photo: 'none',
    value: '5', unit: 'min',
    label: 'To answer a new lead before they call someone else.',
    source: 'Marathon house rule, every PaceCRM buildout',
    confirm: '5 minute window'
  },
  'stat-showcase': {
    type: 'stat', topic: 'tour-3d', photo: 'mc_retouched_05',
    value: '48', unit: 'hrs',
    label: 'From shoot day to a live Zillow Showcase listing.',
    source: 'Marathon turnaround target',
    confirm: '48 hour turnaround'
  },
  'stat-sales': {
    type: 'stat', topic: 'tour-3d', photo: 'mc_rosehill_16',
    value: '$1,250,000', unit: 'in sales',
    label: 'Closed in one quarter on listings we shot with a 3D tour.',
    source: 'Marathon client reporting, one Houston brokerage',
    confirm: '$1,250,000 quarterly figure and the client it comes from'
  },
  'stat-review': {
    type: 'stat', topic: 'email-sms', photo: 'none',
    value: '2', unit: 'hrs',
    label: 'The latest to send a review request after the job.',
    source: 'Marathon house rule, client review campaigns',
    confirm: '2 hour window'
  }
};
render_all.mjs123 lines, 11.1 KB
// Renders every tips card this round ships, plus the photo and long-copy tests.
// Usage, from the repo root: node build/tips-cards/v/r06/render_all.mjs
// Uses a throwaway Chrome profile, never the user's running Chrome.
import { chromium } from 'playwright-core';
import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import url from 'node:url';

const here = path.dirname(url.fileURLToPath(import.meta.url));
const out = path.join(here, 'renders', 'cards');
fs.mkdirSync(out, { recursive: true });

// Copy twice as long as it should be, the way a busy team member would paste it.
const LONG = {
  headline: 'Book the listing photographer around the sunrise and sunset light, not around whatever day the calendar has open this week',
  body: 'Exteriors shoot best in the 2 hours after sunrise or before sunset, when the light is soft and the sky still holds color. Midday sun flattens the facade, puts hard shadows under every eave, and blows out the windows so the rooms look dark from the street. Set the shoot time first and build the open house, the sign install, and the first social post around it. If the seller can only do noon, shoot the interiors then and come back for a twilight exterior on a second visit, it is worth the extra trip.',
  quote: 'Most agencies execute whatever the client asks for on the day they ask. We think first, every time, because the plan has to come before production or the production is wasted money and wasted weeks for everybody involved.',
  label: 'The window you have to answer a brand new website lead before that person picks up the phone and calls the next company on the list',
  source: 'Marathon house rule applied on every single PaceCRM buildout we have shipped for real estate and home service clients since 2024',
  value: '1,250', unit: 'leads'
};

const LONGWORD = 'Shoot1234WestSamHoustonParkwayNorthFrontageRoadIndustrialWarehouseBuildingC';
// A street typed with no spaces, short enough to sit inside the 60 character limit.
const LW = '1234WestSamHoustonParkwayNorth';
const P = { interior: 'mc_retouched_03', aerial: 'mc_rosehill_16', portrait: 'mc_retouched_08', boundary: 'mc_fullres_12' };
const jobs = [
  // The library, at natural length.
  ['tip-portrait-photo', 'portrait', { card: 'zillow-showcase' }],
  ['tip-square-photo', 'square', { card: 'lot-line' }],
  ['tip-portrait-nophoto', 'portrait', { card: 'review-sms' }],
  ['tip-square-nophoto', 'square', { card: 'speed-to-lead' }],
  ['tip-portrait-roofer', 'portrait', { card: 'roof-before' }],
  ['tip-portrait-timing', 'portrait', { card: 'photo-timing' }],
  ['quote-portrait', 'portrait', { card: 'quote-thinks-first' }],
  ['quote-square', 'square', { card: 'quote-long-game' }],
  ['stat-portrait-photo', 'portrait', { card: 'stat-showcase' }],
  ['stat-portrait-nophoto', 'portrait', { card: 'stat-lead-window' }],
  ['stat-square-nophoto', 'square', { card: 'stat-review' }],
  ['stat-square-photo', 'square', { card: 'stat-showcase' }],
  // Long copy on every type and size.
  ['long-tip-portrait-photo', 'portrait', { card: 'photo-timing', photo: P.interior, headline: LONG.headline, body: LONG.body }],
  ['long-tip-square-photo', 'square', { card: 'photo-timing', photo: P.aerial, headline: LONG.headline, body: LONG.body }],
  ['long-tip-portrait-nophoto', 'portrait', { card: 'photo-timing', photo: 'none', headline: LONG.headline, body: LONG.body }],
  ['long-tip-square-nophoto', 'square', { card: 'photo-timing', photo: 'none', headline: LONG.headline, body: LONG.body }],
  ['long-quote-portrait', 'portrait', { card: 'quote-thinks-first', quote: LONG.quote }],
  ['long-quote-square', 'square', { card: 'quote-thinks-first', quote: LONG.quote }],
  ['long-stat-portrait', 'portrait', { card: 'stat-lead-window', photo: P.portrait, label: LONG.label, source: LONG.source, value: LONG.value, unit: LONG.unit }],
  ['long-stat-square', 'square', { card: 'stat-lead-window', label: LONG.label, source: LONG.source, value: LONG.value, unit: LONG.unit }],
  // Long unbroken words: a street name, a parcel ID, and a pasted URL, in every text field.
  ['longword-head-square', 'square', { card: 'photo-timing', photo: 'mc_rosehill_17', headline: 'Shoot ' + LW + ' at dusk.' }],
  ['longword-head-portrait', 'portrait', { card: 'zillow-showcase', photo: P.interior, headline: 'List ' + LW + ' in 48 hours.' }],
  ['longword-body-portrait', 'portrait', { card: 'lot-line', photo: P.boundary, body: 'Fly ' + LW + ' at 200 feet so the buyer sees the frontage.' }],
  ['longword-stat-portrait', 'portrait', { card: 'stat-lead-window', value: '1234567890123', unit: 'WWWWW', label: LONGWORD + ' window', source: 'https://marathoncreative.co/pacecrm/buildouts/speed-to-lead-house-rule' }],
  ['longword-stat-square', 'square', { card: 'stat-showcase', photo: P.portrait, label: 'Hours from shoot day to ' + LW + '.' }],
  ['longword-quote-square', 'square', { card: 'quote-thinks-first', quote: 'We plan ' + LONGWORD + ' before we shoot it.', name: 'JacobDowFounderAndFinalApprover', role: 'MarathonCreativeGreaterHoustonTexas' }],
  // The case a critic caught: one long word in a short main line. It cannot print whole at the
  // 90px floor, so the card blocks export instead of splitting the word with no hyphen.
  ['longword-mittel-portrait', 'portrait', { card: 'zillow-showcase', headline: 'List Mittelwesthoustonindustrialparkwaydrive fast.' }],
  ['longword-mittel-square', 'square', { card: 'photo-timing', photo: 'none', headline: 'List Mittelwesthoustonindustrialparkwaydrive fast.' }],
  // The same street with its spaces put back prints whole.
  ['longword-fixed-portrait', 'portrait', { card: 'zillow-showcase', headline: 'List Mittel West Houston Industrial Parkway fast.' }],
  // A long but real street name with spaces, which should fit whole by stepping the type down.
  ['longword-street-portrait', 'portrait', { card: 'photo-timing', photo: P.aerial, headline: 'Shoot 1234 West Sam Houston Parkway North at dusk.' }],
];
// Copy written right up to every limit, in the widest case, which must still print whole.
const MAX = {
  headline: 'Book the listing shoot for 2 hours after sunrise, not noon.',
  body: 'Midday sun flattens the facade and blows out every window, so set the shoot time first.',
  quote: 'Most agencies execute whatever the client asks for. We think first, then we build it.',
  label: 'Leads answered inside 5 minutes on every PaceCRM buildout, by text first.',
  source: 'Marathon house rule on every PaceCRM buildout, 2025',
};
for (const [k, v] of Object.entries(MAX)) if (v.length > { headline: 60, body: 90, quote: 90, label: 80, source: 60 }[k]) throw new Error(k + ' is over its limit');
jobs.push(
  ['max-tip-portrait-photo', 'portrait', { card: 'photo-timing', photo: P.interior, headline: MAX.headline, body: MAX.body }],
  ['max-tip-square-photo', 'square', { card: 'photo-timing', photo: P.aerial, headline: MAX.headline, body: MAX.body }],
  ['max-tip-square-nophoto', 'square', { card: 'photo-timing', photo: 'none', headline: MAX.headline, body: MAX.body }],
  ['max-quote-square', 'square', { card: 'quote-thinks-first', quote: MAX.quote }],
  ['max-stat-square-photo', 'square', { card: 'stat-lead-window', photo: P.portrait, value: '1,250', unit: 'leads', label: MAX.label, source: MAX.source }],
  ['max-stat-portrait-photo', 'portrait', { card: 'stat-lead-window', photo: P.portrait, value: '1,250', unit: 'leads', label: MAX.label, source: MAX.source }],
  // The unit under a figure with a comma. The comma descender must clear the unit.
  ['unit-1250-portrait', 'portrait', { card: 'stat-lead-window', photo: 'none', value: '1,250', unit: 'leads', label: 'Inbound leads PaceCRM answered by text in one year.', source: 'Marathon client reporting, one Houston brokerage' }],
  ['unit-1250-square', 'square', { card: 'stat-lead-window', photo: P.interior, value: '1,250', unit: 'leads', label: 'Inbound leads PaceCRM answered by text in one year.', source: 'Marathon client reporting, one Houston brokerage' }],
);
// Stat figures. Real long figures print whole by stepping the type down. A figure that cannot fit
// whole at --value-floor blocks the card instead of being cut.
jobs.push(
  ['figure-sales-portrait-photo', 'portrait', { card: 'stat-sales' }],
  ['figure-sales-portrait-nophoto', 'portrait', { card: 'stat-sales', photo: 'none' }],
  ['figure-sales-square-photo', 'square', { card: 'stat-sales', photo: P.interior }],
  ['figure-sales-square-nophoto', 'square', { card: 'stat-sales', photo: 'none' }],
  ['figure-12m-portrait', 'portrait', { card: 'stat-sales', photo: P.portrait, value: '$12,500,000', unit: 'in closed sales' }],
  ['figure-views-square', 'square', { card: 'stat-sales', photo: P.boundary, topic: 'video', value: '1,000,000+', unit: 'video views', label: 'Views on one listing reel, cut in DaVinci and run as a paid ad.' }],
  ['figure-blocked-value', 'portrait', { card: 'stat-sales', photo: 'none', value: '$1,250,000,000,000', unit: 'in sales' }],
  ['figure-blocked-unit', 'square', { card: 'stat-showcase', photo: 'none', value: '48', unit: 'hours from the day we shoot the listing to the day it goes live on Zillow Showcase' }],
);
// Photo robustness. The same cards on each required photo, at natural length and long.
for (const [k, ph] of Object.entries(P)) {
  jobs.push(['photo-' + k + '-tip-portrait', 'portrait', { card: 'lot-line', photo: ph }]);
  jobs.push(['photo-' + k + '-tip-portrait-long', 'portrait', { card: 'photo-timing', photo: ph, headline: MAX.headline, body: MAX.body }]);
  jobs.push(['photo-' + k + '-tip-square', 'square', { card: 'zillow-showcase', photo: ph }]);
  jobs.push(['photo-' + k + '-stat-portrait', 'portrait', { card: 'stat-showcase', photo: ph }]);
  jobs.push(['photo-' + k + '-stat-figure', 'portrait', { card: 'stat-sales', photo: ph }]);
}

const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'mc-chrome-'));
const ctx = await chromium.launchPersistentContext(profile, {
  executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', headless: true, viewport: { width: 1080, height: 1350 },
});
const page = await ctx.newPage();
const report = {};
for (const [name, size, spec] of jobs) {
  const q = new URLSearchParams({ size, ...spec }).toString();
  await page.setViewportSize({ width: 1080, height: size === 'square' ? 1080 : 1350 });
  await page.goto(url.pathToFileURL(path.join(here, 'card.html')).href + '?' + q, { waitUntil: 'networkidle' });
  await page.waitForSelector('body[data-ready="1"]');
  report[name] = await page.evaluate(() => window.MC_FIT);
  await page.locator('.card').screenshot({ path: path.join(out, name + '.png') });
}
fs.writeFileSync(path.join(here, 'renders', 'fit-report.json'), JSON.stringify(report, null, 2));
await ctx.close(); fs.rmSync(profile, { recursive: true, force: true });
console.log('rendered', jobs.length, 'cards');
for (const [k, v] of Object.entries(report)) if (!v.fits || v.trimmed.length || (v.blocked && v.blocked.length) || v.figure) console.log(k, JSON.stringify(v));
render_editor.mjs31 lines, 2.2 KB
// Screenshots the card maker in two states: a long figure that fits whole, and one that blocks export.
// Usage, from the repo root: node build/tips-cards/v/r06/render_editor.mjs
import { chromium } from 'playwright-core';
import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import url from 'node:url';
const here = path.dirname(url.fileURLToPath(import.meta.url));
const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'mc-chrome-'));
const ctx = await chromium.launchPersistentContext(profile, {
  executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', headless: true, viewport: { width: 1440, height: 1200 },
});
const page = await ctx.newPage();
await page.goto(url.pathToFileURL(path.join(here, 'editor.html')).href, { waitUntil: 'networkidle' });
await page.evaluate(() => document.fonts.ready);
await page.selectOption('#card', 'stat-sales');
await page.waitForTimeout(300);
await page.screenshot({ path: path.join(here, 'renders', 'editor.png'), fullPage: true });
await page.fill('input[name="value"]', '$1,250,000,000,000');
await page.waitForTimeout(300);
await page.screenshot({ path: path.join(here, 'renders', 'editor-blocked.png'), fullPage: true });
// A headline pasted at twice the limit: kept whole, counted in red, export blocked, nothing cut.
await page.selectOption('#card', 'photo-timing');
await page.waitForTimeout(300);
await page.fill('textarea[name="headline"]', 'Book the listing photographer around the sunrise and sunset light, not around whatever day the calendar has open this week');
await page.waitForTimeout(300);
await page.screenshot({ path: path.join(here, 'renders', 'editor-long-blocked.png'), fullPage: true });
// One long word in the main line: blocked, the word is named, and there is no export command.
await page.fill('textarea[name="headline"]', 'List Mittelwesthoustonindustrialparkwaydrive fast.');
await page.waitForTimeout(300);
await page.screenshot({ path: path.join(here, 'renders', 'editor-longword-blocked.png'), fullPage: true });
await ctx.close(); fs.rmSync(profile, { recursive: true, force: true });
console.log('wrote editor.png, editor-blocked.png, editor-long-blocked.png, and editor-longword-blocked.png');
build_icons.py18 lines, 1.1 KB
# Copies the icon symbols the tips cards use out of the shared sprite into icons-inline.js.
# Chrome blocks an external <use href> on file://, so the symbols are inlined, never redrawn.
# Run after the icon system changes: python3 build_icons.py
import re, os, json
here = os.path.dirname(os.path.abspath(__file__))
src = open(os.path.join(here, '../../../icons/v/best/icons.svg'), encoding='utf-8').read()
NEED = ["photography", "tour-3d", "email-sms", "drone", "crm", "strategy", "social", "paid-ads", "print-signage", "video"]
out = []
for n in NEED:
    m = re.search(r'<symbol id="mc-icon-' + re.escape(n) + r'".*?</symbol>', src, re.S)
    if not m: raise SystemExit('missing icon ' + n)
    out.append(m.group(0))
sprite = '<svg xmlns="http://www.w3.org/2000/svg" style="display:none">' + ''.join(out) + '</svg>'
open(os.path.join(here, 'icons-inline.js'), 'w', encoding='utf-8').write(
    '// GENERATED by build_icons.py from ../../../icons/v/best/icons.svg. Do not edit.\n'
    'window.MC_ICON_SPRITE = ' + json.dumps(sprite) + ';\n')
print('wrote icons-inline.js with', len(out), 'icons')
compose.py78 lines, 6.0 KB
# Builds the contact sheets from renders/cards/. Run after render_all.mjs.
# Pillow only. Sheet chrome colours are read from tokens.css, never typed here.
import os, re, sys
from PIL import Image, ImageDraw, ImageFont

here = os.path.dirname(os.path.abspath(__file__))
cards = os.path.join(here, 'renders', 'cards')
tok = open(os.path.join(here, '../../../tokens/v/best/tokens.css'), encoding='utf-8').read()
def token(name):
    m = re.search(r'--mc-' + name + r':\s*(#[0-9a-fA-F]{6})', tok)
    return m.group(1)
BG, INK, MUTED, RED = token('gray-100'), token('navy-100'), token('slate-500'), token('red-100')
FONT = os.path.join(here, '../../../tokens/v/best/fonts/Montserrat-VariableFont_wght.ttf')
def font(size, weight):
    f = ImageFont.truetype(FONT, size)
    try: f.set_variation_by_axes([weight])
    except Exception: pass
    return f

def sheet(out, title, sub, rows, scale=0.4, gap=40, pad=70):
    # rows: list of (row label, [card names])
    ims = [[(n, Image.open(os.path.join(cards, n + '.png')).convert('RGB')) for n in names] for _, names in rows]
    ims = [[(n, im.resize((int(im.width * scale), int(im.height * scale)), Image.LANCZOS)) for n, im in r] for r in ims]
    W = pad * 2 + max(sum(im.width for _, im in r) + gap * (len(r) - 1) for r in ims)
    H = pad + 150 + sum(max(im.height for _, im in r) + 110 for r in ims) + pad
    s = Image.new('RGB', (W, H), BG); d = ImageDraw.Draw(s)
    d.text((pad, pad), title.upper(), font=font(22, 700), fill=RED)
    d.text((pad, pad + 34), sub, font=font(40, 800), fill=INK)
    y = pad + 150
    for (label, _), r in zip(rows, ims):
        d.text((pad, y), label, font=font(22, 700), fill=INK); y += 40
        x = pad
        for n, im in r:
            s.paste(im, (x, y))
            d.text((x, y + im.height + 12), n + '.png', font=font(17, 500), fill=MUTED)
            x += im.width + gap
        y += max(im.height for _, im in r) + 70
    s.save(os.path.join(here, 'renders', out)); print('wrote', out, s.size)

PH = {'interior': ('Tight interior, mc_retouched_03, Cangelosi showroom', 'photo-interior.png'),
      'aerial': ('Wide aerial, mc_rosehill_16, Rosehill Reserve rooftops', 'photo-aerial.png'),
      'portrait': ('Portrait original, mc_retouched_08, sample racks, cropped by focal point', 'photo-portrait.png'),
      'boundary': ('Red boundary burned in, mc_fullres_12. No red graphic touches the photo.', 'photo-boundary.png')}
for k, (sub, out) in PH.items():
    sheet(out, 'Tips cards, photo test', sub, [
        ('Tip 1080x1350 natural length, tip 1080x1350 with copy at its limit, tip 1080x1080, stat 1080x1350, stat with $1,250,000',
         ['photo-%s-tip-portrait' % k, 'photo-%s-tip-portrait-long' % k, 'photo-%s-tip-square' % k, 'photo-%s-stat-portrait' % k, 'photo-%s-stat-figure' % k])])

sheet('long-copy.png', 'Tips cards, long copy test', 'Copy at its limit prints whole. Copy twice as long blocks export. Nothing is ever cut', [
    ('Copy written right up to every limit prints whole: tip with photo at both sizes, tip without a photo, quote, stat with 1,250 leads',
     ['max-tip-portrait-photo', 'max-tip-square-photo', 'max-tip-square-nophoto', 'max-quote-square', 'max-stat-portrait-photo']),
    ('Copy pasted at twice the length: the card is blocked, names each field, and says how many characters to cut',
     ['long-tip-portrait-photo', 'long-tip-square-nophoto', 'long-quote-portrait', 'long-stat-portrait', 'long-stat-square'])])

sheet('long-word.png', 'Tips cards, long word test', 'A word that cannot print whole at the floor blocks export. It is never split', [
    ('Main line with one long word at 1080x1350 and 1080x1080: blocked. Spaces put back, and a long street with spaces: prints whole',
     ['longword-mittel-portrait', 'longword-mittel-square', 'longword-fixed-portrait', 'longword-street-portrait']),
    ('A street typed with no spaces: in the main line at 1080x1080 and 1080x1350, blocked. In the smaller supporting line it fits whole, so it prints',
     ['longword-head-square', 'longword-head-portrait', 'longword-body-portrait']),
    ('Stat label, unit, and source URL, stat 1080x1080 on a portrait original, quote name and role',
     ['longword-stat-portrait', 'longword-stat-square', 'longword-quote-square'])])

sheet('stat-figures.png', 'Tips cards, stat figure test', 'The figure is never cut. It steps down in size, or the card is blocked', [
    ('$1,250,000 in sales, 1080x1350 and 1080x1080, with and without a photo',
     ['figure-sales-portrait-photo', 'figure-sales-portrait-nophoto', 'figure-sales-square-photo', 'figure-sales-square-nophoto']),
    ('$12,500,000 on a portrait original, 1,000,000+ on a red boundary lot, and two figures that cannot fit whole, which block export',
     ['figure-12m-portrait', 'figure-views-square', 'figure-blocked-value', 'figure-blocked-unit']),
    ('1,250 leads: the unit wraps under the figure and sits clear of the comma, 1080x1350 and 1080x1080',
     ['unit-1250-portrait', 'unit-1250-square', 'max-stat-square-photo'])])

sheet('primary.png', 'Marathon Creative, marketing tips pillar', 'Tip, quote, and stat cards at 1080x1350 and 1080x1080', [
    ('1080x1350 portrait', ['tip-portrait-photo', 'tip-portrait-nophoto', 'quote-portrait', 'stat-portrait-photo', 'stat-portrait-nophoto']),
    ('1080x1080 square', ['tip-square-photo', 'tip-square-nophoto', 'quote-square', 'stat-square-photo', 'stat-square-nophoto']),
    ('Same template on a tight interior, a wide aerial, a portrait original, and a red boundary lot',
     ['photo-interior-tip-portrait', 'photo-aerial-tip-portrait', 'photo-portrait-tip-portrait', 'photo-boundary-tip-portrait', 'tip-portrait-roofer']),
    ('Figures print whole and the unit clears the comma: $1,250,000, 1,250 leads, $12,500,000, and copy too long, which blocks export instead of being cut',
     ['figure-sales-portrait-photo', 'unit-1250-portrait', 'figure-12m-portrait', 'figure-views-square', 'long-tip-portrait-photo'])], scale=0.36)