/* A folio of laid paper. In reflected light it is a plain printed sheet; held up to the light the room goes
   dark, the paper glows, and the watermark, the laid lines and the note on the back show through. */
:root {
  --desk: #d9d2c5; --desk-ink: #4b4438; --paper: #f6efe1; --ink: #211d17; --muted: #6b6152; --rule: rgba(33, 29, 23, .22);
  --accent: #7a3b1d;
  --serif: "Libre Caslon Text", Georgia, serif; --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --hand: "Nothing You Could Do", cursive;
  --t: .9s;
  color-scheme: light;
}
html.lit { --desk: #110e0b; --desk-ink: #a99a83; --ink: #1b130b; --muted: #57472f; --rule: rgba(40, 26, 10, .25); color-scheme: dark; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }
body {
  margin: 0; min-height: 100vh; background: var(--desk); color: var(--desk-ink);
  font: 400 17px/1.65 var(--serif); transition: background-color var(--t) ease, color var(--t) ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
html.lit :focus-visible { outline-color: #f0c674; }
.skip { position: absolute; left: 10px; top: 8px; transform: translateY(-200%); background: var(--ink); color: var(--paper); padding: 6px 12px; z-index: 9; }
.skip:focus { transform: none; }

/* ---------- the desk ---------- */
.desk-top, .desk-bottom { width: min(100% - 32px, 860px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.desk-top { padding: 22px 0 18px; }
.brand { font: 400 15px/1 var(--display); letter-spacing: .34em; text-transform: uppercase; text-decoration: none; }
.folio { margin: 0; font-style: italic; font-size: 15px; }
.lamp { display: inline-flex; align-items: center; gap: 9px; font: italic 400 15px/1 var(--serif); color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 8px 15px 8px 11px; cursor: pointer; transition: background-color .3s, color .3s; }
.lamp svg { width: 20px; height: 20px; }
.lamp:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.lamp-off, .lit .lamp-on { display: none; }
.lit .lamp-off { display: inline; }
.lit .lamp { color: #f3d48d; border-color: #f3d48d80; }
.desk-bottom { padding: 26px 0 8px; font-size: 15px; }
.pn { text-decoration: none; min-width: 8em; }
.pn:hover { text-decoration: underline; }
.pn.next { text-align: right; }
.contents { min-width: 0; font-style: italic; }
.desk-foot { width: min(100% - 32px, 860px); margin: 0 auto; padding: 4px 0 36px; text-align: center; font-size: 13px; font-style: italic; opacity: .75; }

/* ---------- the stack of sheets ---------- */
.stack { width: min(100% - 32px, 760px); margin: 0 auto; perspective: 2200px; }
body::before { /* the light box behind the sheet, only seen when it is held up; fixed to the viewport so it never widens the page */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse min(70vw, 760px) 70vh at 50% 48%, rgba(255, 214, 140, .5), rgba(255, 190, 110, .1) 60%, transparent 100%);
  opacity: 0; transition: opacity var(--t) ease;
}
.lit body::before { opacity: 1; }
.desk-top, .desk-bottom, .desk-foot, .stack { position: relative; z-index: 1; }
.under { position: absolute; inset: 0; background: #efe7d6; z-index: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); transition: opacity var(--t); }
.u1 { transform: translate(7px, 6px) rotate(.8deg); }
.u2 { transform: translate(-5px, 9px) rotate(-.6deg); background: #ebe2cf; }
.lit .under { opacity: 0; }
.sheet { position: relative; z-index: 1; display: block; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.5, .05, .25, 1); }
.sheet:focus { outline: none; }
.sheet.over { transform: rotateY(180deg); }
.face { backface-visibility: hidden; -webkit-backface-visibility: hidden; filter: drop-shadow(0 1px 1px rgba(40, 30, 15, .16)) drop-shadow(0 14px 22px rgba(40, 30, 15, .14)); }
.lit .face { filter: drop-shadow(0 0 30px rgba(255, 200, 120, .35)); }
.back { position: absolute; inset: 0; transform: rotateY(180deg); }
.paper {
  position: relative; min-height: calc(min(100vw - 32px, 760px) * 1.3); height: 100%; overflow: hidden;
  background-color: var(--paper); color: var(--ink);
  padding: clamp(28px, 7%, 64px) clamp(22px, 8.5%, 72px) clamp(40px, 8%, 72px);
  transition: background-color var(--t), color var(--t);
}
.paper::before, .paper::after { content: ""; position: absolute; inset: 0; pointer-events: none; transition: opacity var(--t) ease; }
.paper::before { /* fibres, always */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 .45  0 0 0 0 .37  0 0 0 0 .25  0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}
.paper::after { /* light coming through: a glow and the cloudy "formation" of the pulp */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.018' numOctaves='4' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .5  0 0 0 0 .32  0 0 0 0 .1  0 0 0 1.15 -.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 75% 60% at 50% 42%, #fff6dc, #f6dfaa 55%, #e2bf7c);
  opacity: 0; mix-blend-mode: multiply;
}
.lit .paper { background-color: #f8e6bb; }
.lit .paper::after { opacity: 1; }
.laid { /* laid and chain lines, from the wire mould */
  position: absolute; inset: 0; pointer-events: none; opacity: .0; transition: opacity var(--t) ease;
  background:
    repeating-linear-gradient(90deg, transparent 0 64px, rgba(120, 82, 30, .22) 64px 65.5px),
    repeating-linear-gradient(0deg, transparent 0 2.4px, rgba(255, 250, 230, .45) 2.4px 3.4px);
}
.lit .laid { opacity: 1; }
.mark { position: absolute; left: 50%; bottom: 7%; width: min(56%, 380px); transform: translateX(-50%); z-index: 1; pointer-events: none; }
.mark g { stroke: rgba(120, 100, 70, .045); stroke-width: 2.6; transition: stroke var(--t); }
.lit .mark g { stroke: rgba(255, 252, 238, .95); }
.lit .mark { filter: drop-shadow(0 0 1.5px rgba(255, 250, 230, .9)); }
.back .mark { transform: translateX(-50%) scaleX(-1); }
.through { /* the back's line, seen through the paper, reversed */
  position: absolute; left: 12%; right: 12%; top: 38%; z-index: 1; margin: 0; text-align: center; pointer-events: none;
  font: 400 clamp(22px, 3.4vw, 30px)/1.35 var(--hand); color: #3d2a12;
  transform: scaleX(-1) rotate(2deg); opacity: 0; filter: blur(.6px); transition: opacity var(--t) ease;
}
.lit .through { opacity: .2; }
.print { position: relative; z-index: 2; transition: color var(--t); }
.verso-note { position: relative; z-index: 2; margin: 32% 6% 0; font: 400 clamp(22px, 3.4vw, 30px)/1.4 var(--hand); color: #2d2418; transform: rotate(-2deg); }
.turn {
  position: absolute; right: 0; bottom: 0; z-index: 3;
  font: italic 400 14px/1 var(--serif); color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 26px 16px 14px 34px;
  background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .0) 80%);
}
.turn:hover { color: var(--ink); }
.turn-b, .turned .turn-a { display: none; }
.turned .turn-b { display: inline; }

/* ---------- printed matter ---------- */
.letterhead { display: grid; grid-template-columns: 1fr auto; gap: 18px 28px; align-items: end; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.letterhead h1 { margin: 0; font: 400 clamp(34px, 5.6vw, 54px)/1 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.lh-tag { margin: 8px 0 0; font-style: italic; color: var(--muted); }
.lh-addr { font-style: normal; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 13px; letter-spacing: .04em; }
.lh-addr a { text-decoration: none; color: var(--muted); }
.lh-addr a:hover { color: var(--ink); text-decoration: underline; }
.date { text-align: right; font-style: italic; color: var(--muted); margin: 22px 0 22px; font-size: 15px; }
.letter p { margin: 0 0 14px; max-width: 58ch; }
.sign { margin: 22px 0 0; display: flex; flex-direction: column; }
.sig { font: 400 36px/1 var(--hand); color: #26324f; transform: rotate(-4deg); transform-origin: left; display: inline-block; }
.lit .sig { color: #1d1a20; }
.sig-t { font-size: 14px; color: var(--muted); letter-spacing: .06em; margin-top: 8px; }
.encl { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--rule); }
.encl h2, .lh-small, .parts dt { font: 700 12px/1.6 var(--serif); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.encl h2 { margin: 0 0 8px; }
.encl ol { list-style: none; margin: 0; padding: 0; }
.encl li a { display: grid; grid-template-columns: 2.2em 8.6em 1fr; gap: 12px; align-items: baseline; padding: 7px 0; text-decoration: none; border-bottom: 1px dotted var(--rule); }
.encl li a:hover .en-t { text-decoration: underline; }
.en-no { font-style: italic; color: var(--muted); }
.en-t { font-weight: 700; }
.en-k { color: var(--muted); font-style: italic; font-size: 15px; }
.encl-reply { margin: 14px 0 0; font-style: italic; }
.lh-small { display: flex; justify-content: space-between; margin: 0 0 clamp(30px, 6vw, 56px); padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.lh-small a { text-decoration: none; }
.p-title { margin: 0; font: 400 clamp(44px, 8vw, 84px)/.98 var(--display); letter-spacing: -.01em; }
.p-kind { margin: 14px 0 26px; font-style: italic; font-size: clamp(19px, 2.4vw, 23px); color: var(--muted); }
.p-body p { margin: 0 0 14px; max-width: 56ch; }
.parts { display: grid; grid-template-columns: 8.5em 1fr; gap: 10px 18px; margin: 28px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); }
.parts dt { line-height: 2.1; }
.parts dd { margin: 0; }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 22px; }
.ext { font-size: .8em; margin-left: 2px; color: var(--accent); }
.lit .ext { color: inherit; }

.postcard { display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.pc-msg { padding: 22px 22px 22px 0; border-right: 1px solid var(--rule); }
.pc-addr { position: relative; padding: 22px 0 22px 22px; }
.mail { margin: 0 0 14px; font: 400 clamp(22px, 3.2vw, 30px)/1.2 var(--display); overflow-wrap: anywhere; }
.copy { font: italic 400 14px/1 var(--serif); color: var(--ink); background: none; border: 1px solid var(--rule); padding: 8px 12px; cursor: pointer; }
.copy:hover { border-color: var(--ink); }
.stamp { float: right; width: 66px; height: 78px; margin: 0 0 10px 12px; padding: 7px; color: #4b5fd6; background: #fbf6ea;
  -webkit-mask: radial-gradient(circle 3.2px at 3.2px 3.2px, transparent 98%, #000) -3.2px -3.2px / 10px 10px; mask: radial-gradient(circle 3.2px at 3.2px 3.2px, transparent 98%, #000) -3.2px -3.2px / 10px 10px;
  box-shadow: inset 0 0 0 5px #fbf6ea, inset 0 0 0 6px rgba(75, 95, 214, .35); transform: rotate(3deg); }
.stamp svg { width: 100%; height: 100%; }
.elsewhere { margin: 0; padding: 0; border: 0; grid-template-columns: 5.5em 1fr; }
.ps { margin: 26px 0 0; font-style: italic; max-width: 58ch; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .desk-top { padding: 16px 0 14px; flex-wrap: wrap; row-gap: 10px; }
  .folio { order: 3; width: 100%; font-size: 14px; }
  .brand { font-size: 13px; letter-spacing: .26em; }
  .lamp { font-size: 14px; padding: 7px 12px 7px 9px; }
  .stack, .desk-top, .desk-bottom, .desk-foot { width: calc(100% - 20px); }
  .u1 { transform: translate(0, 6px); }
  .u2 { transform: translate(0, 10px); }
  .paper { min-height: 0; padding: 26px 20px 120px; }
  .letterhead { grid-template-columns: 1fr; }
  .lh-addr { align-items: flex-start; }
  .date { text-align: left; }
  .encl li a { grid-template-columns: 1.6em 1fr; row-gap: 0; }
  .en-k { grid-column: 2; }
  .parts { grid-template-columns: 1fr; gap: 2px; }
  .parts dd + dt { margin-top: 10px; }
  .postcard { grid-template-columns: 1fr; }
  .pc-msg { border-right: 0; border-bottom: 1px solid var(--rule); padding-right: 0; }
  .pc-addr { padding-left: 0; }
  .mark { width: 62%; bottom: 3%; }
  .through { top: 30%; }
  .verso-note { margin-top: 40%; }
  .desk-bottom { font-size: 14px; }
  .pn { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  :root { --t: .01s; }
  .sheet { transition: none; }
}
