/* Email Builder case study: the builder's workspace and its emails, rebuilt in plain CSS.
   Colours are the tool's own: the navy app chrome, the #276CF8 blue, and the light and
   dark email palettes it exports. Small text keeps at least 4.5:1 contrast. */

.eb, .eb-scope {
  --eb-ui: #091428;      /* app chrome */
  --eb-panel: #0d1a3a;   /* menus and popovers */
  --eb-canvas: #050c1a;  /* behind the email */
  --eb-line: #1e3a5f;
  --eb-text: #b8cce0;
  --eb-dim: #7f9cc0;
  --eb-blue: #276CF8;
  --eb-sky: #2FB4FF;
  --eb-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- The email (shared by the hero and the walkthrough) ---------- */
.eb-mail {
  /* dark palette */
  --m-head: #0d1a3a; --m-hero: #132558; --m-strip: #1a3370; --m-bg: #0d1a3a;
  --m-ink: #ffffff; --m-body: #b8cce0; --m-stat: #2FB4FF; --m-label: #94a3b8;
  width: 100%; margin: 0 auto; border-radius: 10px 10px 0 0; overflow: hidden; text-align: center;
  transition: width 0.7s var(--spring-soft, ease);
}
.eb-mail > * { transition: background-color 0.5s ease, color 0.5s ease; }
[data-theme="light"] .eb-mail {
  --m-head: #ffffff; --m-hero: #f4f8ff; --m-strip: #eef2ff; --m-bg: #ffffff;
  --m-ink: #032e5a; --m-body: #567390; --m-stat: #276CF8; --m-label: #567390;
}
.eb-m-head { padding: 0.7rem 1rem; background: var(--m-head); text-align: left; }
.eb-m-logo { font-weight: 800; font-style: italic; font-size: 14px; letter-spacing: -0.02em; color: var(--m-ink); transition: color 0.5s ease; }
.eb-m-hero { padding: 1.4rem 1rem 1.35rem; background: var(--m-hero); }
.eb-m-h { font-weight: 800; font-size: 17px; line-height: 1.15; letter-spacing: -0.01em; color: var(--m-ink); text-wrap: balance; transition: color 0.5s ease; }
.eb-m-sub { margin: 0.5rem auto 0; max-width: 22rem; font-size: 10.5px; line-height: 1.5; color: var(--m-body); transition: color 0.5s ease; }
.eb-m-btn { display: inline-block; margin-top: 0.9rem; padding: 0.5rem 1.1rem; border-radius: 999px; background: var(--eb-blue); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 1.2; }
.eb-m-strip { padding: 0.55rem 1rem; font-size: 9px; line-height: 1.45; background: var(--m-strip); color: var(--m-ink); }
.eb-m-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; padding: 1rem 0.75rem 1.1rem; background: var(--m-bg); }
.eb-m-stats b { display: block; font-size: 16px; font-weight: 800; line-height: 1.1; color: var(--m-stat); font-variant-numeric: tabular-nums; transition: color 0.5s ease; }
.eb-m-stats span { display: block; margin-top: 0.25rem; font-size: 7.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--m-label); transition: color 0.5s ease; }

/* ---------- Workspace chrome ---------- */
.eb-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--eb-line); font-size: 11px; line-height: 1; white-space: nowrap; }
.eb-mark { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--eb-blue); color: #fff; font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.eb-bar b { color: #fff; font-size: 12.5px; font-weight: 600; }
.eb-dim { color: var(--eb-dim); }
.eb-count { margin-left: auto; color: var(--eb-dim); font-variant-numeric: tabular-nums; }
.eb-tools { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--eb-line); }
.eb-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--eb-line); }
.eb-seg > * { font: inherit; font-size: 11px; font-weight: 600; line-height: 1; padding: 0.45rem 0.75rem; border-radius: 999px; border: 0; background: none; color: var(--eb-dim); transition: background-color 0.3s ease, color 0.3s ease; }
.eb-seg button { cursor: pointer; }
.eb-seg button:hover { color: #fff; }
.eb-seg button[aria-pressed="true"] { background: var(--eb-blue); color: #fff; }
.eb-seg + .eb-seg button[aria-pressed="true"] { background: #fff; color: #0d1a3a; } /* the theme toggle is white, as in the tool */
.eb-seg button:focus-visible, .eb-tpls button:focus-visible, .eb-step:focus-visible, .eb-pause:focus-visible { outline: 2px solid var(--eb-sky); outline-offset: 2px; }
.eb-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--eb-dim); }

/* ---------- Hero: the builder you can poke ---------- */
.eb-app { width: min(100%, 27rem); border-radius: 18px; overflow: hidden; background: var(--eb-ui); color: var(--eb-text); text-align: left; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.08), 0 30px 60px -20px rgb(0 0 0 / 0.75); }
.eb-canvas { position: relative; height: 330px; overflow: hidden; padding: 1rem 1rem 0; background: var(--eb-canvas); }
.eb-canvas::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: linear-gradient(rgb(5 12 26 / 0), var(--eb-canvas)); pointer-events: none; }
.eb-app[data-view="mobile"] .eb-mail { width: 62%; }
.eb-app[data-view="mobile"] .eb-m-stats { grid-template-columns: minmax(0, 1fr); gap: 0.7rem; }
.js .eb-mail.is-swap > * { animation: eb-swap 0.45s ease both; }
@keyframes eb-swap { from { opacity: 0.25; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.eb-tpls { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; margin-top: 1.25rem; }
.eb-tpls button { font: inherit; font-size: 0.8125rem; font-weight: 600; line-height: 1; padding: 0.55rem 0.95rem; border-radius: 999px; cursor: pointer; color: rgb(245 240 235 / 0.78); background: transparent; border: 1px solid rgb(245 240 235 / 0.22); transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease; }
.eb-tpls button:hover { color: rgb(245 240 235); border-color: rgb(245 240 235 / 0.45); }
.eb-tpls button[aria-pressed="true"] { color: rgb(var(--c-peach)); background: rgb(var(--c-peach) / 0.14); border-color: rgb(var(--c-peach) / 0.5); }
html:not(.js) .eb-tpls, html:not(.js) .eb-app .eb-seg { visibility: hidden; }

/* ---------- The walkthrough: template to Braze ---------- */
.eb { position: relative; isolation: isolate; overflow: hidden; border-radius: 1.5rem; background: var(--eb-canvas); color: #fff; }
.eb::before { /* a quiet blue glow, the tool's accent */
  content: ''; position: absolute; z-index: -1; left: 30%; top: -18%; width: 640px; height: 440px; transform: translateX(-50%);
  background: rgb(39 108 248 / 0.16); border-radius: 50%; filter: blur(110px); pointer-events: none;
}
.eb-flow { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 2.5rem; padding: 2.5rem 1.25rem; }
@media (min-width: 900px) { .eb-flow { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4rem; padding: 3.5rem 4.5rem; } }
.eb-device { position: relative; display: flex; flex-direction: column; width: min(360px, 100%); height: 470px; border-radius: 16px; overflow: hidden; background: var(--eb-ui); color: var(--eb-text); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 25px 50px -12px rgb(0 0 0 / 0.8); }
.eb-device .eb-tools { gap: 0.4rem; padding: 0.55rem 0.7rem; }
.eb-device .eb-seg > * { font-size: 10px; padding: 0.4rem 0.55rem; }
.eb-flow .eb-f-desk { background: var(--eb-blue); color: #fff; }
.eb-flow .eb-f-dark { background: #fff; color: #0d1a3a; }
.eb-flow[data-step="3"] .eb-f-desk, .eb-flow[data-step="4"] .eb-f-desk,
.eb-flow[data-step="3"] .eb-f-dark, .eb-flow[data-step="4"] .eb-f-dark { background: transparent; color: var(--eb-dim); }
.eb-flow[data-step="3"] .eb-f-mob, .eb-flow[data-step="4"] .eb-f-mob { background: var(--eb-blue); color: #fff; }
.eb-flow[data-step="3"] .eb-f-light, .eb-flow[data-step="4"] .eb-f-light { background: #fff; color: #0d1a3a; }
.eb-copy { position: relative; flex: none; margin-left: auto; padding: 0.45rem 0.7rem; border-radius: 999px; background: var(--eb-blue); color: #fff; font-size: 10px; font-weight: 600; line-height: 1; white-space: nowrap; }
.eb-copy-b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: #0f2a1d; box-shadow: inset 0 0 0 1.5px #22c55e; color: #4ade80; opacity: 0; }
.eb-body { position: relative; flex: 1; overflow: hidden; background: var(--eb-canvas); }

.eb-s { position: absolute; inset: 0; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.eb-flow[data-step="0"] .eb-s-pick,
.eb-flow[data-step="1"] .eb-s-mail, .eb-flow[data-step="2"] .eb-s-mail,
.eb-flow[data-step="3"] .eb-s-mail, .eb-flow[data-step="4"] .eb-s-mail { opacity: 1; transform: none; }

/* 0 · Template: pick one from the list */
.eb-s-pick { padding: 1.1rem 1rem; }
.eb-select { margin-top: 0.5rem; padding: 0.6rem 0.75rem; border-radius: 8px; border: 1px solid var(--eb-line); background: var(--eb-ui); font-size: 11.5px; color: #fff; }
.eb-options { list-style: none; margin: 0.35rem 0 0; padding: 0.3rem; border-radius: 8px; border: 1px solid var(--eb-line); background: var(--eb-panel); box-shadow: 0 16px 32px -12px rgb(0 0 0 / 0.6); }
.eb-options li { padding: 0.5rem 0.6rem; border-radius: 6px; font-size: 11.5px; line-height: 1.2; color: var(--eb-text); }
.eb-flow[data-step="0"] .eb-options .eb-pick { animation: eb-pick 0.5s ease 1.3s both; }
@keyframes eb-pick { from { background: transparent; color: var(--eb-text); } to { background: var(--eb-blue); color: #fff; } }

/* 1 · Blocks: the Stats block drops in */
.eb-s-mail { padding: 1rem 1rem 0; }
.eb-flow[data-step="3"] .eb-mail, .eb-flow[data-step="4"] .eb-mail { width: 64%; }
.eb-flow[data-step="3"] .eb-m-stats, .eb-flow[data-step="4"] .eb-m-stats { grid-template-columns: minmax(0, 1fr); }
.eb-flow[data-step="3"] .eb-mail, .eb-flow[data-step="4"] .eb-mail {
  --m-head: #ffffff; --m-hero: #f4f8ff; --m-strip: #eef2ff; --m-bg: #ffffff;
  --m-ink: #032e5a; --m-body: #567390; --m-stat: #276CF8; --m-label: #567390;
}
.eb-new { overflow: hidden; }
.eb-flow[data-step="1"] .eb-new { box-shadow: inset 0 0 0 1.5px var(--eb-blue); animation: eb-grow 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.2s both; }
@keyframes eb-grow { from { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; } to { max-height: 90px; opacity: 1; } }
.eb-pop { position: absolute; left: 1.5rem; top: 4.25rem; width: 158px; padding: 0.55rem; border-radius: 10px; border: 1px solid var(--eb-line); background: var(--eb-panel); box-shadow: 0 18px 36px -12px rgb(0 0 0 / 0.7); text-align: left; opacity: 0; }
.eb-pop ul { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.eb-pop li { padding: 0.4rem 0.5rem; border-radius: 6px; font-size: 11px; color: var(--eb-text); }
.eb-flow[data-step="1"] .eb-pop { animation: eb-popio 2.1s ease 0.2s both; }
.eb-flow[data-step="1"] .eb-pop .eb-pick { animation: eb-pick 0.35s ease 1.1s both; }
@keyframes eb-popio { 0% { opacity: 0; transform: translateY(6px); } 12%, 84% { opacity: 1; transform: none; } 100% { opacity: 0; transform: none; } }

/* 2 · Edit: type in the preview; the Liquid tag keeps its fallback */
.eb-edit { position: relative; border-radius: 3px; }
.eb-flow[data-step="2"] .eb-edit { outline: 1.5px dashed rgb(47 180 255 / 0.85); outline-offset: 4px; }
.eb-flow[data-step="2"] .eb-edit::after { content: ''; display: inline-block; width: 1.5px; height: 1em; margin-left: 2px; vertical-align: -0.15em; background: var(--eb-sky); animation: eb-caret 1s steps(1) infinite; }
@keyframes eb-caret { 50% { opacity: 0; } }
.eb-liquid { position: absolute; left: 50%; top: 6.6rem; transform: translateX(-50%); white-space: nowrap; padding: 0.4rem 0.65rem; border-radius: 8px; border: 1px solid var(--eb-blue); background: var(--eb-panel); box-shadow: 0 12px 24px -10px rgb(0 0 0 / 0.7); font: 600 10px/1.2 var(--eb-mono); color: var(--eb-text); opacity: 0; }
.eb-flow[data-step="2"] .eb-liquid { animation: eb-show 0.4s ease-out 0.9s both; }

/* 4 · Copy: Braze-ready HTML, tracking already on the link */
.eb-flow[data-step="4"] .eb-copy-b { animation: eb-show 0.3s ease-out 0.6s both; }
.eb-code { position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; margin: 0; padding: 0.85rem 0.9rem; border-radius: 10px; border: 1px solid var(--eb-line); background: #030814; box-shadow: 0 -12px 32px -8px rgb(0 0 0 / 0.6); font: 9.5px/1.6 var(--eb-mono); color: var(--eb-text); white-space: pre; overflow: hidden; opacity: 0; }
.eb-code .t { color: var(--eb-dim); }
.eb-code .u { color: var(--eb-sky); }
.eb-flow[data-step="4"] .eb-code { animation: eb-rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) 1s both; }
@keyframes eb-show { from { opacity: 0; transform: translate(var(--tx, 0), 6px); } to { opacity: 1; transform: translate(var(--tx, 0), 0); } }
.eb-liquid { --tx: -50%; }
@keyframes eb-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* The step list */
.eb-steps { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 28rem; display: flex; flex-direction: column; gap: 0.25rem; }
.eb-step { position: relative; width: 100%; display: grid; grid-template-columns: 2.25rem 1fr; gap: 0.25rem 0.75rem; text-align: left; padding: 0.85rem 1rem; border-radius: 1rem; background: none; border: 1px solid transparent; color: rgb(255 255 255 / 0.62); cursor: pointer; font: inherit; overflow: hidden; transition: background-color 0.3s, border-color 0.3s, color 0.3s; }
.eb-step:hover { background: rgb(255 255 255 / 0.03); }
.eb-step .n { grid-row: span 2; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; padding-top: 0.2rem; color: rgb(255 255 255 / 0.55); }
.eb-step b { font-size: 1rem; font-weight: 700; color: #fff; }
.eb-step small { font-size: 0.875rem; line-height: 1.45; }
.eb-step[aria-current="step"] { background: var(--eb-ui); border-color: rgb(255 255 255 / 0.07); color: rgb(255 255 255 / 0.8); }
.eb-step[aria-current="step"] .n { color: var(--eb-sky); }
.eb-step .bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: linear-gradient(to right, var(--eb-blue), var(--eb-sky)); transform: scaleX(0); transform-origin: left; }
.eb-flow.is-playing .eb-step[aria-current="step"] .bar { animation: eb-bar var(--d, 3s) linear both; }
.eb-flow.is-paused .eb-step[aria-current="step"] .bar { animation-play-state: paused; }
@keyframes eb-bar { to { transform: scaleX(1); } }
.eb-flow-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: 0 1rem; font-size: 0.75rem; color: rgb(255 255 255 / 0.6); }
.eb-pause { font-family: inherit; font-size: 0.75rem; font-weight: 600; line-height: 1; letter-spacing: 0.1em; text-transform: uppercase; color: rgb(255 255 255 / 0.8); background: rgb(255 255 255 / 0.06); border: 1px solid rgb(255 255 255 / 0.1); border-radius: 999px; padding: 0.55rem 0.9rem; cursor: pointer; }
.eb-pause[hidden] { display: none; }

/* ---------- Light sections ---------- */
.eb-chains { display: grid; gap: 0.6rem; }
.eb-chain-label + .eb-chain { margin-bottom: 1.25rem; }
.eb-chain { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border-radius: 0.75rem; overflow: hidden; border: 1px solid rgb(var(--c-border)); background: rgb(var(--c-border)); }
@media (min-width: 768px) { .eb-chain { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.eb-chain li { background: rgb(var(--c-surface)); padding: 1.1rem 1.25rem; }
.eb-chain span { display: block; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.12em; color: rgb(var(--c-faint)); }
.eb-chain b { display: block; margin-top: 0.4rem; font-family: 'Syne', sans-serif; font-size: 1.0625rem; font-weight: 700; color: rgb(var(--c-ink)); }
.eb-chain small { display: block; margin-top: 0.2rem; font-size: 0.875rem; line-height: 1.4; color: rgb(var(--c-muted)); }
.eb-chain.is-before b { color: rgb(var(--c-muted)); }
.eb-chain.is-after li { background: linear-gradient(rgb(var(--c-jungle) / 0.08), rgb(var(--c-jungle) / 0.08)) rgb(var(--c-surface)); }
.eb-chain.is-after span { color: rgb(var(--c-accent)); }
.eb-tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.eb-tags li { padding: 0.5rem 0.95rem; border-radius: 999px; border: 1px solid rgb(var(--c-border)); font-size: 0.875rem; font-weight: 500; color: rgb(var(--c-ink)); }
.eb-list { font-size: 0.875rem; font-weight: 500; line-height: 1.9; color: rgb(var(--c-ink)); }

/* Small screens: the walkthrough's toolbar keeps only what fits */
@media (max-width: 480px) {
  .eb-device .eb-seg:first-child { display: none; }
  .eb-app .eb-bar .eb-dim { display: none; }
  .eb-device { height: 440px; }
}

/* Less motion: every step shows its end state, nothing plays on its own */
@media (prefers-reduced-motion: reduce) {
  .eb *, .eb *::before, .eb *::after, .eb-scope *, .eb-scope *::before { animation: none !important; transition: none !important; }
  .eb-flow[data-step="0"] .eb-options .eb-pick { background: var(--eb-blue); color: #fff; }
  .eb-flow[data-step="2"] .eb-liquid, .eb-flow[data-step="4"] .eb-copy-b, .eb-flow[data-step="4"] .eb-code { opacity: 1; }
  .eb-flow[data-step="2"] .eb-edit::after { display: none; }
}
