/* ─────────────────────────────────────────────────────────────────────────
   PUSSY FACTORY, INC. · the internal-memo look.

   Pages that read as company paperwork that has been through the office:
   photocopied, faxed, printed, marked up in red pen and screen printed. Used by
   the home page and the Orientation record (/orientation/record/).

   USAGE
     <link rel="stylesheet" href="/styles.css" />     <- brand tokens first
     <link rel="stylesheet" href="/pf-memo.css" />
     <body class="… memo-look">
       <div class="stack">
         <div class="mpage"> <p class="faxhead">…</p> … </div>   one per page of the document
         <div class="mpage" style="--stock: …; --skew: .3deg"> … </div>
       </div>

   Each .mpage is one sheet. Its paper (::before) sits a fraction of a degree
   crooked under the contents, the way a page sits on the copier glass, and
   carries the toner speckle and the dark copier edge. Pages set:
     --stock   the paper (default --paper-2)
     --skew    how crooked it sat on the glass (default -.25deg)

   Parts: .faxhead (the fax machine's header line), .staple, .punch3 (binder
   holes), .anno (red-pen notes, set in the hand face), .hl (highlighter),
   .rstamp (a rubber stamp), .tape-strip (masking tape).

   The hand face (Caveat) is loaded by the page that uses .anno. Annotations are
   set dressing: give them aria-hidden and the .pf-camp class, never put a fact
   only in one.

   Depends on styles.css tokens: --paper, --paper-2, --paper-3, --ink, --line.
   ───────────────────────────────────────────────────────────────────────── */

.memo-look {
  --memo-red: var(--cranberry, #8f2638);          /* the red pen, and the second screen-print ink */
  --hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  --highlighter: color-mix(in srgb, #d9b85c 62%, transparent);
  --metal-hi: #e2e2de;
  --metal-lo: #8d8d88;
  --masking: color-mix(in srgb, #e9dcb8 82%, transparent);
  /* toner: sparse dark specks, the dust on the copier glass */
  --toner: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='1' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 .13 0 0 0 0 .11 0 0 0 0 .09 -60 0 0 0 15.5'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
}

/* the pile of pages */
.memo-look .stack { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; }

.mpage { --pad: clamp(20px, 3vw, 40px); position: relative; isolation: isolate; padding: var(--pad); }
.mpage + .mpage { margin-top: clamp(1.25rem, 3vw, 2.25rem); }
.mpage::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border: 1px solid var(--line);
  background:
    var(--toner) 0 0 / 260px 260px,
    /* the copier's dark edge, where the page didn't meet the glass */
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 20%, transparent), transparent) left top / 16px 100% no-repeat,
    linear-gradient(0deg, color-mix(in srgb, var(--ink) 12%, transparent), transparent) left bottom / 100% 10px no-repeat,
    /* uneven toner: the middle of the page prints a little lighter than its edges */
    radial-gradient(130% 95% at 48% 38%, transparent 60%, color-mix(in srgb, var(--ink) 9%, transparent) 100%),
    var(--stock, var(--paper-2));
  transform: rotate(var(--skew, -.25deg));
  box-shadow: 0 1px 1px color-mix(in srgb, var(--ink) 16%, transparent),
              0 30px 56px -38px rgba(34, 29, 24, .85); }
@media (max-width: 40em) { .mpage::before { transform: rotate(calc(var(--skew, -.25deg) * .35)); } }

/* the fax machine's header line, printed across the top of every page */
.faxhead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 1.25rem;
  margin: calc(var(--pad) * -.4) 0 clamp(14px, 2vw, 22px); padding-bottom: 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 26%, transparent);
  font: 400 .6875rem/1.35 "Space Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 74%, var(--paper)); }
.faxhead b { font-weight: 700; color: var(--ink); }

/* hardware */
.staple { position: absolute; z-index: 3; top: 14px; left: 18px; width: 32px; height: 5px; border-radius: 2px;
  transform: rotate(-28deg); pointer-events: none;
  background: linear-gradient(180deg, var(--metal-hi), var(--metal-lo));
  box-shadow: 0 1px 1px color-mix(in srgb, var(--ink) 45%, transparent); }
.punch3 { position: absolute; left: 9px; top: 12%; bottom: 12%; width: 15px; display: flex; flex-direction: column;
  justify-content: space-between; pointer-events: none; }
.punch3 i { display: block; width: 15px; height: 15px; border-radius: 50%; background: var(--paper);
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--ink) 50%, transparent); }
@media (max-width: 40em) { .punch3 { display: none; } }
.tape-strip { position: absolute; z-index: 3; width: 78px; height: 22px; pointer-events: none;
  background: var(--masking); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 22%, transparent);
  transform: rotate(var(--r, -4deg)); }

/* the red pen */
.anno { position: absolute; z-index: 5; pointer-events: none; white-space: nowrap;
  font: 600 1.45rem/1 var(--hand); color: var(--memo-red); transform: rotate(var(--r, -5deg)); }
.anno svg { position: absolute; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round; }
/* margin notes need a margin: on a phone they would sit on the words */
@media (max-width: 56em) { .anno.wide { display: none; } }

/* a ring drawn round a word, in red pen */
.ring { position: relative; display: inline-block; }
.ring > svg { position: absolute; left: -.5em; top: -.34em; width: calc(100% + 1em); height: calc(100% + .68em);
  overflow: visible; fill: none; stroke: var(--memo-red); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }

/* the highlighter, laid over the lower part of the line the way a hand swipes it */
.hl { padding: 0 .12em; margin: 0 -.12em;
  background: linear-gradient(180deg, transparent 50%, var(--highlighter) 50% 92%, transparent 92%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* a rubber stamp */
.rstamp { display: inline-block; color: var(--memo-red); border: 3px double var(--memo-red); border-radius: 4px;
  padding: .3rem .75rem; font: 700 .8rem/1.3 "Space Mono", ui-monospace, monospace; letter-spacing: .18em;
  text-transform: uppercase; transform: rotate(var(--r, -6deg)); mix-blend-mode: multiply; opacity: .82; }

@media (forced-colors: active) {
  .mpage::before { background: Canvas; border-color: CanvasText; }
  .hl { background: Mark; color: MarkText; }
}
