/* =====================================================================
   Paper and Ink · essays/when-every-buyer-orders-twice.css
   "When Every Buyer Orders Twice": the figures only this essay uses.
   Loaded after the shared stylesheets; everything shared lives in css/.
   ===================================================================== */

/* Layout: one 64ch reading column on grained paper; two paper objects break out to 860px:
   a sales slip and a purchase order with a pencil note between them (Figure 1)
   and a stock-and-pipeline ledger with a choice of ordering rule (Figure 2).
   Gold = end-customer consumption; blue = replenishment orders. */

/* ---- footnote markers -------------------------------------------------- */
sup.ref { font-family: var(--sans); font-size: .62em; line-height: 0; margin-left: 1px; }
sup.ref a { text-decoration: none; color: var(--life); padding: 0 1px; }
sup.ref a:hover { text-decoration: underline; }
.sources li:target { color: var(--ink); background: var(--life-soft); }

/* ---- Figure 1: the sales slip and the purchase order ---------------------- */
/* three columns in one row: slip, pencil note, order; the note is vertically centred between them */
.slipfig2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1fr); gap: 20px 24px; align-items: center; overflow-x: clip; overflow-clip-margin: 14px; padding-top: 6px; }
.sslip, .po { position: relative; padding: 1rem 1.1rem 1.1rem; font-family: var(--mono); font-size: .74rem; line-height: 1.5; }
.sslip { background: var(--noise), var(--slip); border-top: 5px solid var(--slip-once); color: var(--slip-once); transform: rotate(-1deg); animation: fade .6s ease .1s both; }
.po { background: var(--noise), var(--sheet); border-top: 5px solid var(--slip-life); color: var(--slip-life); transform: rotate(.8deg); animation: fade .6s ease 1.5s both; }
.ph { font-family: var(--sans); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--slip-ink); opacity: .75; margin: 0 0 .5rem; }
.pr { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin: 0; padding: .2rem 0; border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent); }
.pr span { color: var(--slip-ink); min-width: 0; }
.pr b { font-weight: 500; text-align: right; }
.pr b.big { font-family: var(--serif); font-size: 2rem; line-height: 1; font-weight: 500; }
.pf { margin: .6rem 0 0; font-family: var(--serif); font-style: italic; font-size: 1rem; }
.pencil { color: var(--graphite); font-size: 1.05rem; animation: fade .7s ease .8s both; }
.pencil p { margin: 0 0 .45rem; }
.pencil b { color: var(--ink); }
.pencil .pen { display: block; margin: .2rem auto 0; }
.pencil .pen path { animation-delay: 1.1s; }

/* ---- Figure 2: the stock-and-pipeline ledger ----------------------------- */
.pick { border: 0; margin: 0 0 1.1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-family: var(--sans); font-size: .86rem; color: var(--ink); }
.pick legend { padding: 0; margin-bottom: .35rem; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pick label { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.pick input { accent-color: var(--life); margin: 0; }
.pick input:focus-visible { outline: 2px solid var(--life); outline-offset: 3px; }
.ledger {
  position: relative; padding: 1.5rem 1.2rem 1.1rem; transform: rotate(.3deg); color: var(--slip-ink);
  background: var(--noise), repeating-linear-gradient(transparent 0 27px, var(--grid-major) 27px 28px), var(--slip);
  box-shadow: 0 1px 1px var(--shadow), 0 10px 24px -12px var(--shadow-deep);
}
.ledger::before { content: ""; position: absolute; top: -11px; left: 22px; width: 92px; height: 26px; background: var(--noise), var(--tape); transform: rotate(-4deg); }
.lh { font-family: var(--sans); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; margin: 0; opacity: .8; }
.lr { font-family: var(--mono); font-size: .78rem; margin: .45rem 0 .8rem; color: var(--slip-life); }
.lgrid { font-family: var(--mono); font-size: .8rem; font-variant-numeric: tabular-nums; }
.lrow { display: grid; grid-template-columns: 3.4rem repeat(5, minmax(0, 1fr)) minmax(0, 2.2fr); gap: .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid color-mix(in srgb, var(--slip-ink) 15%, transparent); }
.lrow span { min-width: 0; text-align: right; }
.lrow span:first-child { text-align: left; }
.lhd { font-family: var(--sans); font-size: .6rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; align-items: end; border-bottom: 1.5px solid currentColor; }
.lrow .once { color: var(--slip-once); }
.lrow .life { color: var(--slip-life); font-weight: 600; }
.lrow.start { color: var(--graphite); }
.lrow.wk { animation: fade .45s ease both; }
.lrow.wk:nth-child(3) { animation-delay: .3s; }
.lrow.wk:nth-child(4) { animation-delay: .6s; }
.lrow.wk:nth-child(5) { animation-delay: .9s; }
.lrow.wk:nth-child(6) { animation-delay: 1.2s; }
/* the bar: blue length is the order, the gold tick is that week's sales, both on a 0 to 160 scale */
.lbar { position: relative; height: .9rem; text-align: left; }
.lhd .lbar { height: auto; }
.lbar .ob { position: absolute; left: 0; top: .1rem; bottom: .1rem; background: var(--slip-life); opacity: .8; transition: width .3s ease; }
.lbar .sm { position: absolute; top: -.1rem; bottom: -.1rem; width: 2px; margin-left: -1px; background: var(--slip-once); transition: left .3s ease; }
.ob.v60 { width: 37.5%; }   .ob.v80 { width: 50%; }   .ob.v100 { width: 62.5%; }   .ob.v120 { width: 75%; }   .ob.v140 { width: 87.5%; }
.sm.v100 { left: 62.5%; }   .sm.v120 { left: 75%; }
.ln { margin: .9rem 0 0; }
.ln .g { color: var(--slip-once); }
.ln .b { color: var(--slip-life); }

@media (max-width: 760px) {
  .slipfig2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pencil { grid-column: 1 / -1; grid-row: 2; }
  .pencil .pen { display: none; }
  .po { grid-row: 1; grid-column: 2; }
}

/* Phone mode: the slip, the note and the order stack; the ledger keeps its six number columns
   with short headers and draws each week's bar on its own line beneath the numbers. */
@media (max-width: 560px) {
  .slipfig2 { grid-template-columns: minmax(0, 1fr); }
  .po { grid-column: 1; grid-row: auto; }
  .pencil { grid-row: auto; }
  .ph, .lh { font-size: .7rem; }
  .ledger { padding: 1.4rem .8rem 1rem; }
  .lgrid { font-size: .74rem; }
  .lrow { grid-template-columns: 2.6rem repeat(5, minmax(0, 1fr)); gap: .25rem .35rem; }
  .lrow .lbar { grid-column: 1 / -1; }
  .lhd .lbar { display: none; }
  .lhd { font-size: .7rem; letter-spacing: 0; }
  .lr { font-size: .74rem; }
}

/* Dark mode: the pencil notes sit on the page, so they take the page's muted ink. */
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .pencil{color:var(--muted)}}
:root[data-theme="dark"] .pencil{color:var(--muted)}
