/* ─────────────────────────────────────────────────────────────────────────
   Essay embeds — one shared hand for every interactive piece set into a post.
   Paper, rules, Fraunces numerals, one caption treatment, one time-thread
   control. Loaded ONLY on posts whose body carries an allowlisted
   <div data-embed="…"> (see blog.py body_embeds).

   No layout shift: every placeholder reserves its final height BEFORE the
   module mounts (min-height per name, below). Pieces are built to fit.
   ───────────────────────────────────────────────────────────────────────── */

.post-body div[data-embed] {
  --ess-ease: cubic-bezier(.22, 1, .36, 1);
  --ess-ink: var(--text);
  --ess-dim: var(--text-dim);
  --ess-faint: var(--text-faint);
  --ess-rule: var(--panel-border);
  --ess-rule-hot: var(--panel-border-hot);
  --ess-accent: var(--warm-glow);
  --ess-paper: var(--panel-solid);
  --ess-night: #0b0f16;
  --ess-night-ink: #efe6d6;
  display: block;
  position: relative;
  margin: 2.2em 0 2.4em;
  padding: 26px 0 22px;
  border-top: 1px solid var(--ess-rule);
  border-bottom: 1px solid var(--ess-rule);
  color: var(--ess-ink);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-user-select: none; user-select: none;
  box-sizing: border-box;
}
.post-body div[data-embed] * { box-sizing: border-box; }
.post-body div[data-embed="ledger"] { -webkit-user-select: text; user-select: text; }

/* Reserved heights (desktop ≥ 481px). Each piece = stage + control + caption. */
.post-body div[data-embed="naming"]              { min-height: 770px; }
.post-body div[data-embed="divide-recombine"]    { min-height: 665px; }
.post-body div[data-embed="containers"]          { min-height: 960px; }
.post-body div[data-embed="table-that-predicted"]{ min-height: 960px; }
.post-body div[data-embed="finished-map"]        { min-height: 905px; }
.post-body div[data-embed="two-eyes"]            { min-height: 775px; }
.post-body div[data-embed="ledger"]              { min-height: 1584px; }

/* ── type ── */
.ess-num, .ess-year, .ess-count {
  font-family: 'Fraunces', serif; font-variant-numeric: tabular-nums lining-nums;
  font-weight: 400; letter-spacing: -0.01em;
}
.ess-eyebrow {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ess-faint); font-weight: 600; margin: 0 0 12px;
}
.ess-cap {
  font-family: 'Fraunces', serif; font-style: italic; font-weight: 300;
  font-size: 16.5px; line-height: 1.45; color: var(--ess-dim);
  margin: 18px 0 0; min-height: 48px; letter-spacing: -0.005em;
}
.ess-cap em { font-style: normal; color: var(--ess-ink); }
.ess-src {
  font-size: 11.5px; line-height: 1.5; color: var(--ess-faint); margin: 8px 0 0; min-height: 17px;
}
.ess-src a { color: inherit; text-decoration: underline; text-decoration-color: var(--ess-rule-hot); text-underline-offset: 2px; }
.ess-src a:hover { color: var(--ess-dim); }
.ess-hint { font-size: 12.5px; color: var(--ess-faint); margin: 0; min-height: 19px; transition: opacity .6s var(--ess-ease); }
.ess-hint.is-gone { opacity: 0; }

/* ── stage ── */
.ess-stage {
  position: relative; width: 100%; overflow: hidden; border-radius: 6px;
  background: var(--ess-paper); border: 1px solid var(--ess-rule);
}
.ess-stage.is-night { background: var(--ess-night); color: var(--ess-night-ink); border-color: rgba(255,255,255,.06); }
.ess-stage svg { display: block; width: 100%; height: 100%; }
.ess-stage svg text { font-family: 'Fraunces', serif; }
.ess-stage:focus-visible { outline: 2px solid var(--ess-accent); outline-offset: 2px; }

/* ── the time thread (one horizontal line, one knob) ── */
.ess-thread { position: relative; height: 56px; margin: 8px 0 0; }
.ess-thread .ess-year {
  position: absolute; top: 0; transform: translateX(-50%); font-size: 18px; color: var(--ess-ink);
  pointer-events: none; white-space: nowrap; transition: color .4s var(--ess-ease);
}
.ess-thread .ess-thread-ticks { position: absolute; left: 0; right: 0; top: 34px; height: 12px; pointer-events: none; }
.ess-thread .ess-thread-ticks span {
  position: absolute; top: 0; width: 1px; height: 6px; background: var(--ess-rule-hot); transform: translateX(-.5px);
}
.ess-thread .ess-thread-ticks i {
  position: absolute; top: 10px; transform: translateX(-50%); font-style: normal; font-size: 10px;
  color: var(--ess-faint); font-family: 'Fraunces', serif; letter-spacing: .02em;
}
.ess-thread input[type="range"] {
  -webkit-appearance: none; appearance: none; position: absolute; left: 0; right: 0; top: 24px;
  width: 100%; height: 20px; margin: 0; background: transparent; cursor: ew-resize; touch-action: pan-y;
}
.ess-thread input[type="range"]:focus { outline: none; }
.ess-thread input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--ess-rule-hot); }
.ess-thread input[type="range"]::-moz-range-track { height: 1px; background: var(--ess-rule-hot); }
.ess-thread input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; margin-top: -6.5px;
  background: var(--ess-paper); border: 1.5px solid var(--ess-ink); transition: transform .3s var(--ess-ease);
}
.ess-thread input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--ess-paper); border: 1.5px solid var(--ess-ink);
}
.ess-thread input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--warm-glow-soft); }
.ess-thread input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--warm-glow-soft); }
.ess-thread input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }

/* ── quiet controls (segmented toggle, text button) ── */
.ess-seg { display: inline-flex; border: 1px solid var(--ess-rule-hot); border-radius: 999px; padding: 2px; gap: 2px; }
.ess-seg button {
  appearance: none; border: 0; background: transparent; color: var(--ess-dim); font: inherit; font-size: 12.5px;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: background .4s var(--ess-ease), color .4s var(--ess-ease);
}
.ess-seg button[aria-pressed="true"] { background: var(--ess-ink); color: var(--bg-deep); }
.ess-seg button:focus-visible { outline: 2px solid var(--ess-accent); outline-offset: 1px; }
.ess-btn {
  appearance: none; border: 1px solid var(--ess-rule-hot); background: transparent; color: var(--ess-dim); font: inherit;
  font-size: 12.5px; padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: color .3s, border-color .3s;
}
.ess-btn:hover { color: var(--ess-ink); border-color: var(--ess-ink); }
.ess-btn:focus-visible { outline: 2px solid var(--ess-accent); outline-offset: 1px; }
.ess-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 0 0; min-height: 34px; }

/* ── piece 1: the naming ── */
.ess-naming .ess-stage { height: 300px; }
.ess-naming .ess-plate {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-family: 'Fraunces', serif; font-size: 34px; font-weight: 300; letter-spacing: .04em; color: var(--ess-night-ink);
  padding: 8px 22px; border: 1px solid rgba(239,230,214,.35);
  transition: transform 1.1s var(--ess-ease), opacity 1s var(--ess-ease), border-color .6s;
  will-change: transform, opacity;
}
.ess-naming .ess-plate.is-lifted { transform: translate(-50%, calc(-50% - 120px)); opacity: 0; }
.ess-naming .ess-mech {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(6px); opacity: 0;
  font-size: 12.5px; letter-spacing: .04em; color: rgba(239,230,214,.72); white-space: nowrap;
  transition: opacity .9s var(--ess-ease) .35s, transform .9s var(--ess-ease) .35s; font-family: 'Manrope', sans-serif;
}
.ess-naming .ess-mech.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.ess-naming .ess-phen {
  position: absolute; left: 18px; top: 16px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(239,230,214,.5); font-family: 'Manrope', sans-serif;
}
.ess-naming .ess-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ess-naming .ess-tabs button {
  appearance: none; border: 0; background: transparent; color: var(--ess-faint); font: inherit; font-size: 12.5px;
  padding: 6px 10px; border-radius: 999px; cursor: pointer; transition: color .3s, background .3s;
}
.ess-naming .ess-tabs button[aria-selected="true"] { color: var(--ess-ink); background: var(--hover-tint-strong); }
.ess-naming .ess-tabs button:focus-visible { outline: 2px solid var(--ess-accent); outline-offset: 1px; }
.ess-naming svg .fx { transition: opacity .8s var(--ess-ease); }

/* ── piece 2: divide, then recombine ── */
.ess-divide .ess-stage { height: 320px; cursor: pointer; touch-action: none; }
.ess-divide .ess-stage.is-recombine { cursor: default; }
.ess-divide .ess-part { cursor: grab; transition: transform .7s var(--ess-ease); }
.ess-divide .ess-part.is-dragging { cursor: grabbing; transition: none; }
.ess-divide .ess-part path { transition: fill .5s, stroke .5s; }
.ess-divide .ess-part:focus { outline: none; }
.ess-divide .ess-part:focus-visible path { stroke: var(--ess-accent); stroke-width: 2; }
.ess-divide .ess-verb {
  position: absolute; left: 18px; top: 16px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ess-faint);
  transition: opacity .6s var(--ess-ease);
}
.ess-divide .ess-label { font-size: 11px; fill: var(--ess-dim); letter-spacing: .05em; font-family: 'Fraunces', serif; pointer-events: none; }

/* ── piece 3: containers ── */
.ess-containers .ess-stage { height: 330px; }
.ess-containers .vessel { transition: transform 1.2s var(--ess-ease), opacity 1s var(--ess-ease); }
.ess-containers .vessel.is-retired { opacity: .45; }
.ess-containers .fill { transition: height .9s var(--ess-ease), y .9s var(--ess-ease), opacity .9s; }
.ess-containers .vname { font-size: 12px; fill: var(--ess-ink); font-family: 'Fraunces', serif; }
.ess-containers .vstate { font-size: 10px; fill: var(--ess-faint); font-family: 'Manrope', sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.ess-containers .shelf-label { font-size: 10px; fill: var(--ess-faint); letter-spacing: .14em; text-transform: uppercase; font-family: 'Manrope', sans-serif; }

/* ── piece 4: the table that predicted ── */
.post-body .ess-table .ess-stage { height: 536px; padding: 16px 12px 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.post-body .ess-table table { border-collapse: separate; border-spacing: 3px 2px; margin: 0 auto; font-family: 'Fraunces', serif; }
.post-body .ess-table td { width: 68px; height: 24px; text-align: center; font-size: 12px; white-space: nowrap; color: var(--ess-dim); padding: 0; position: relative;
  border-radius: 3px; border: 1px solid transparent; vertical-align: middle; }
.post-body .ess-table td.el { color: var(--ess-ink); }
.post-body .ess-table td.el small { font-size: 12px; color: var(--ess-dim); font-family: inherit; }
.post-body .ess-table td.gap { border: 1px dashed var(--ess-rule-hot); cursor: pointer; color: var(--ess-faint); transition: border-color .4s, background .4s, color .4s; }
.post-body .ess-table td.gap:hover, .post-body .ess-table td.gap:focus-visible, .post-body .ess-table td.gap[aria-expanded="true"] { border-color: var(--ess-accent); color: var(--ess-accent); background: var(--warm-glow-soft); outline: none; }
.post-body .ess-table td.gap.is-filled { border-style: solid; color: var(--ess-ink); }
.post-body .ess-table .ess-note {
  min-height: 74px; margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start;
  transition: opacity .6s var(--ess-ease);
}
.post-body .ess-table .ess-note.is-empty { opacity: .55; }
.post-body .ess-table .ess-note h4 { margin: 0 0 3px; font: 400 11px/1.4 'Manrope', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--ess-faint); }
.post-body .ess-table .ess-note p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--ess-dim); }
.post-body .ess-table .ess-note p b { font-family: 'Fraunces', serif; font-weight: 400; color: var(--ess-ink); font-size: 16px; }
.post-body .ess-table .ess-note .ess-year { font-size: 13px; color: var(--ess-accent); margin-left: 6px; }

/* ── piece 5: the finished map ── */
.ess-map .ess-stage { height: 360px; }
.ess-map .ess-stage svg .land { transition: fill 1.4s var(--ess-ease), opacity 1.4s var(--ess-ease), stroke .8s; }
.ess-map .ess-stage svg .sea  { transition: fill 1.4s var(--ess-ease), opacity 1.4s var(--ess-ease); }
.ess-map .ess-stage svg .honest { transition: opacity 1.4s var(--ess-ease) .3s; }
.ess-map .ess-figs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 14px; margin: 14px 0 0; min-height: 60px; }
.ess-map .ess-figs div { min-width: 0; }
.ess-map .ess-figs .ess-num { font-size: 22px; line-height: 1; color: var(--ess-ink); display: block; transition: color .8s var(--ess-ease); }
.ess-map .ess-figs .ess-num.is-dim { color: var(--ess-faint); }
.ess-map .ess-figs span { display: block; font-size: 11px; line-height: 1.35; color: var(--ess-faint); margin-top: 4px; }

/* ── piece 6: two eyes, one place ── */
.ess-eyes .ess-stage { height: 360px; }
.ess-eyes .mark { transition: opacity 1s var(--ess-ease), transform 1s var(--ess-ease); transform-box: fill-box; transform-origin: center; }
.ess-eyes .mark.is-off { opacity: 0; transform: scale(.85); }
.ess-eyes .mark text { font-size: 11px; fill: var(--ess-ink); font-family: 'Fraunces', serif; font-style: italic; }
.ess-eyes .mark circle { fill: none; stroke: var(--ess-accent); stroke-width: 1.2; }
.ess-eyes .scene { transition: opacity .8s var(--ess-ease); }
.ess-eyes .ess-legend { font-size: 12.5px; color: var(--ess-dim); min-height: 19px; }

/* ── piece 7: the ledger ── */
.post-body .ess-ledger .ess-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.post-body .ess-ledger .ess-count { font-size: 44px; line-height: 1; color: var(--ess-ink); display: block; }
.post-body .ess-ledger .ess-count-lbl { font-size: 12px; color: var(--ess-faint); letter-spacing: .12em; text-transform: uppercase; margin-top: 6px; }
.post-body .ess-ledger .ess-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-body .ess-ledger input[type="search"] {
  appearance: none; font: inherit; font-size: 13px; color: var(--ess-ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--ess-rule-hot); padding: 6px 2px; width: 190px; border-radius: 0; outline: none;
  transition: border-color .3s;
}
.post-body .ess-ledger input[type="search"]:focus { border-bottom-color: var(--ess-ink); }
.post-body .ess-ledger input[type="search"]::placeholder { color: var(--ess-faint); }
.post-body .ess-ledger .ess-tbl { margin: 16px 0 0; border-top: 1px solid var(--ess-rule-hot); min-height: 610px; }
.post-body .ess-ledger .ess-tbl table { width: 100%; border-collapse: collapse; margin: 0; }
.post-body .ess-ledger .ess-tbl th {
  text-align: left; font: 600 10.5px/1.3 'Manrope', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--ess-faint);
  padding: 10px 8px 8px 0; border: 0; border-bottom: 1px solid var(--ess-rule); cursor: pointer; white-space: nowrap; user-select: none;
}
.post-body .ess-ledger .ess-tbl th[aria-sort] { color: var(--ess-ink); }
.post-body .ess-ledger .ess-tbl th:focus-visible { outline: 2px solid var(--ess-accent); outline-offset: -2px; }
.post-body .ess-ledger .ess-tbl td { border: 0; border-bottom: 1px solid var(--ess-rule); padding: 11px 10px 11px 0; font-size: 13px; line-height: 1.45; color: var(--ess-dim); vertical-align: top; }
.post-body .ess-ledger .ess-tbl td.subj { color: var(--ess-ink); font-family: 'Fraunces', serif; font-size: 14.5px; min-width: 120px; }
.post-body .ess-ledger .ess-tbl td.subj small { display: block; font: 400 10.5px/1.3 'Manrope', sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ess-faint); margin-top: 2px; }
.post-body .ess-ledger .ess-tbl td.open { color: var(--ess-ink); }
.post-body .ess-ledger .ess-tbl td.open .x { font-family: 'Fraunces', serif; font-style: italic; color: var(--ess-accent); margin-right: 6px; }
.post-body .ess-ledger .ess-tbl td.open.is-closed .x { color: var(--ess-faint); }
.post-body .ess-ledger .ess-tbl td.want { width: 34px; padding-right: 0; text-align: right; }
.post-body .ess-ledger .ess-want {
  appearance: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ess-rule-hot); background: transparent;
  cursor: pointer; padding: 0; display: inline-grid; place-items: center; color: var(--ess-faint); transition: border-color .3s, color .3s, background .3s;
}
.post-body .ess-ledger .ess-want:hover { border-color: var(--ess-ink); color: var(--ess-ink); }
.post-body .ess-ledger .ess-want[aria-pressed="true"] { background: var(--ess-ink); border-color: var(--ess-ink); color: var(--bg-deep); }
.post-body .ess-ledger .ess-want:focus-visible { outline: 2px solid var(--ess-accent); outline-offset: 2px; }
.post-body .ess-ledger .ess-want svg { width: 11px; height: 11px; display: block; }
.post-body .ess-ledger .ess-cite a { color: var(--ess-faint); text-decoration: none; border-bottom: 1px solid var(--ess-rule-hot); font-size: 11.5px; }
.post-body .ess-ledger .ess-cite a:hover { color: var(--ess-dim); }
.post-body .ess-ledger .ess-more { text-align: center; padding: 14px 0 0; }
.post-body .ess-ledger .ess-empty { padding: 34px 0; text-align: center; color: var(--ess-faint); font-family: 'Fraunces', serif; font-style: italic; }
.post-body .ess-ledger .ess-foot { margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--ess-rule-hot); }
.post-body .ess-ledger .ess-foot p { margin: 0; font-family: 'Fraunces', serif; font-style: italic; font-weight: 300; font-size: 17px; color: var(--ess-ink); }
.post-body .ess-ledger .ess-foot p b { font-style: normal; font-weight: 400; }
.post-body .ess-ledger form { display: flex; align-items: flex-end; gap: 10px; margin: 14px 0 0; flex-wrap: wrap; }
.post-body .ess-ledger form input[type="email"] {
  appearance: none; font: inherit; font-size: 14px; color: var(--ess-ink); background: transparent; border: 0; border-radius: 0;
  border-bottom: 1px solid var(--ess-rule-hot); padding: 6px 2px; width: min(300px, 100%); outline: none; transition: border-color .3s;
}
.post-body .ess-ledger form input[type="email"]:focus { border-bottom-color: var(--ess-ink); }
.post-body .ess-ledger form input[type="email"]::placeholder { color: var(--ess-faint); }
.post-body .ess-ledger .ess-status { margin: 8px 0 0; font-size: 12.5px; color: var(--ess-dim); min-height: 19px; }

/* ── reduced motion: everything lands at once ── */
@media (prefers-reduced-motion: reduce) {
  .post-body div[data-embed] *, .post-body div[data-embed] *::before, .post-body div[data-embed] *::after {
    transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important;
  }
}

/* ── phone (375px column) ── */
@media (max-width: 480px) {
  .post-body div[data-embed] { font-size: 13px; padding: 20px 0 18px; }
   .post-body div[data-embed="naming"]              { min-height: 830px; }
   .post-body div[data-embed="divide-recombine"]    { min-height: 550px; }
   .post-body div[data-embed="containers"]          { min-height: 1020px; }
   .post-body div[data-embed="table-that-predicted"]{ min-height: 1060px; }
   .post-body div[data-embed="finished-map"]        { min-height: 1105px; }
   .post-body div[data-embed="two-eyes"]            { min-height: 860px; }
   .post-body div[data-embed="ledger"]              { min-height: 2500px; }
  .ess-cap { font-size: 15px; min-height: 44px; }
  .ess-naming .ess-stage { height: 260px; }
  .ess-naming .ess-plate { font-size: 28px; }
  .ess-divide .ess-stage { height: 290px; }
  .ess-containers .ess-stage { height: 300px; }
.post-body .ess-table .ess-stage { height: 470px; padding: 10px 6px 8px; }
.post-body .ess-table table { border-spacing: 2px 1px; }
.post-body .ess-table td { width: 52px; height: 22px; font-size: 10px; }
.post-body .ess-table td.el small { font-size: 10px; }
.post-body .ess-table .ess-note { grid-template-columns: 1fr; gap: 8px; min-height: 132px; }
  .ess-map .ess-stage { height: 300px; }
  .ess-map .ess-figs { grid-template-columns: repeat(2, 1fr); min-height: 120px; }
  .ess-eyes .ess-stage { height: 300px; }
.post-body .ess-ledger .ess-count { font-size: 36px; }
.post-body .ess-ledger .ess-tbl table { table-layout: fixed; }
.post-body .ess-ledger .ess-tbl th.prop, .post-body .ess-ledger .ess-tbl th.und { display: none; }
.post-body .ess-ledger .ess-tbl th.subj { width: 46%; }
.post-body .ess-ledger .ess-tbl tbody tr { display: grid; grid-template-columns: 1fr 34px; border-bottom: 1px solid var(--ess-rule); padding: 10px 0; }
.post-body .ess-ledger .ess-tbl tbody td { display: block; border: 0; padding: 0 0 4px; min-width: 0; overflow-wrap: anywhere; }
.post-body .ess-ledger .ess-tbl tbody td.want { grid-column: 2; grid-row: 1 / span 4; padding-top: 2px; }
.post-body .ess-ledger .ess-tbl tbody td.subj { font-size: 15px; }
.post-body .ess-ledger .ess-tbl tbody td.prop { color: var(--ess-dim); font-size: 12.5px; }
.post-body .ess-ledger .ess-tbl tbody td.und { font-size: 12px; color: var(--ess-faint); }
.post-body .ess-ledger .ess-tbl tbody td.open { padding-top: 2px; }
.post-body .ess-ledger .ess-tbl thead tr { display: grid; grid-template-columns: 1fr 1fr 34px; }
.post-body .ess-ledger .ess-tbl thead th { min-width: 0; }
.post-body .ess-ledger input[type="search"] { width: 150px; }
}
