/* Memory Shore: the wall is an art print with its title set large on it, and paper
   notes scattered across. Notes and art keep their colours in night mode; the page
   around them follows it. memory-shore.js draws the same art and notes on pictures. */

:root {
  --mem-ink: #2b1f17;
  --mem-soft: #6f5544;
  --mem-paper: #fff8ef;
  --mem-panel: #ffffff;
  --mem-field: #fffdf9;
  --mem-line: #efdccb;
  --mem-accent: #b4532a;
  --mem-accent-soft: #fde4d6;
  --mem-on-accent: #ffffff;
  --mem-strong: #2b1f17;
  --mem-on-strong: #ffffff;
  --mem-note-ink: #33241a;
  --mem-note-soft: #6a5140;
  --mem-display: "Playfair Display", Georgia, serif;
  --mem-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mem-quick: "Caveat", "Segoe Print", cursive;
  --mem-neat: "Kalam", "Segoe Print", cursive;
  --mem-playful: "Gaegu", "Segoe Print", cursive;
  --mem-urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
  --mem-shadow: 0 1px 1px rgba(70, 40, 12, .14), 0 3px 6px rgba(70, 40, 12, .1), 0 18px 26px -14px rgba(70, 40, 12, .5);
  --mem-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-blog-theme="dark"] {
  --mem-ink: #f3e7dc;
  --mem-soft: #bfa896;
  --mem-paper: #1c1612;
  --mem-panel: #241c16;
  --mem-field: #1c1612;
  --mem-line: #3a2e25;
  --mem-accent: #ec8a5c;
  --mem-accent-soft: #3a2418;
  --mem-on-accent: #1c1612;
  --mem-strong: #f3e7dc;
  --mem-on-strong: #1c1612;
}

.mem-page { color: var(--mem-ink); font-family: var(--mem-ui); display: grid; gap: 22px; padding-block: 8px 48px; }
.mem-page > * { min-width: 0; }
.mem-page h1, .mem-page h2, .mem-page h3 { color: inherit; }
.mem-page :focus-visible, .mem-dialog :focus-visible { outline: 2px solid var(--mem-accent); outline-offset: 2px; }

.mem-alert { padding: 10px 14px; border-radius: 8px; background: var(--mem-accent-soft); color: var(--mem-ink); font-weight: 600; }

/* Buttons */
.mem-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--mem-line); border-radius: 8px; background: var(--mem-panel); color: var(--mem-ink); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.mem-btn:hover { border-color: var(--mem-accent); color: var(--mem-ink); }
.mem-btn svg { width: 16px; height: 16px; flex: none; }
.mem-btn-main { background: var(--mem-accent); border-color: var(--mem-accent); color: var(--mem-on-accent); }
.mem-btn-main:hover { color: var(--mem-on-accent); filter: brightness(1.06); }
.mem-btn-danger { color: #b3261e; border-color: #e7b7b2; }
.mem-btn-danger:hover { color: #b3261e; border-color: #b3261e; }
[data-blog-theme="dark"] .mem-btn-danger, [data-blog-theme="dark"] .mem-btn-danger:hover { color: #f2998f; }
.mem-btn[disabled] { opacity: .55; cursor: default; }

/* ---------- The Memory Shore page ---------- */

.mem-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 330px); gap: 20px 32px; align-items: end; }
.mem-hero h1 { font: 800 clamp(2.2rem, 5vw, 3.2rem)/1.08 var(--mem-display); margin: 0; text-wrap: balance; }
.mem-hero h1 span { color: var(--mem-accent); }
.mem-hero p { margin: 8px 0 0; max-width: 58ch; color: var(--mem-soft); font-size: 16px; }
.mem-hero-actions { display: grid; gap: 10px; min-width: 0; }
.mem-hero-actions .mem-btn-main { justify-content: center; padding-block: 11px; }
.mem-join { display: flex; gap: 6px; min-width: 0; }
.mem-join input { flex: 1 1 auto; min-width: 0; padding: 8px 10px; border: 1px solid var(--mem-line); border-radius: 8px; background: var(--mem-field); color: var(--mem-ink); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.mem-join input::placeholder { letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--mem-soft); }
.mem-section-title { font: 800 1.35rem/1.2 var(--mem-display); margin: 0 0 12px; }
.mem-count { color: var(--mem-soft); font: 400 14px var(--mem-ui); margin-left: 6px; }

.mem-walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 265px), 1fr)); gap: 16px; }
.mem-tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 22px; min-height: 178px; padding: 16px 18px; border-radius: 12px; overflow: hidden; background: var(--mem-art); color: var(--mem-title); text-decoration: none; box-shadow: 0 12px 22px -16px rgba(70, 40, 12, .7); transition: transform .15s ease; }
.mem-tile:hover { transform: translateY(-3px); color: var(--mem-title); }
.mem-tile::before { content: ""; position: absolute; inset: 0; background: var(--mem-grain); pointer-events: none; }
.mem-tile > * { position: relative; }
.mem-tile small { font-size: 12.5px; font-weight: 700; opacity: .85; }
.mem-tile b { display: block; font: italic 600 1.55rem/1.12 var(--mem-display); overflow-wrap: anywhere; }
.mem-tile-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; font-weight: 600; }
.mem-new { background: var(--mem-title); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; }
.mem-readonly-tag { display: inline-flex; align-items: center; gap: 3px; }
.mem-readonly-tag svg { width: 13px; height: 13px; }

.mem-empty { padding: 32px 24px; border: 1px dashed var(--mem-line); border-radius: 12px; text-align: center; color: var(--mem-soft); }
.mem-empty strong { display: block; font: 800 1.3rem/1.25 var(--mem-display); color: var(--mem-ink); margin-bottom: 4px; }

.mem-card { max-width: 480px; margin: 24px auto; padding: 24px; border: 1px solid var(--mem-line); border-radius: 14px; background: var(--mem-panel); display: grid; gap: 12px; }
.mem-card h1 { font: 800 1.7rem/1.2 var(--mem-display); margin: 0; }
.mem-card p { margin: 0; color: var(--mem-soft); }
.mem-join-tile { min-height: 130px; }

/* ---------- Wall art ---------- */

.mem-art-golden { --mem-art: radial-gradient(at 12% 8%, #ffd79c 0, transparent 52%), radial-gradient(at 88% 14%, #ff9f8c 0, transparent 50%), radial-gradient(at 75% 92%, #f6b9d0 0, transparent 52%), radial-gradient(at 8% 92%, #ffc48a 0, transparent 50%), linear-gradient(#ffe6c8, #ffe6c8); --mem-title: #5c2412; }
.mem-art-seaglass { --mem-art: radial-gradient(at 10% 12%, #a6ead7 0, transparent 52%), radial-gradient(at 90% 10%, #93d5ea 0, transparent 50%), radial-gradient(at 80% 92%, #d9f3bf 0, transparent 52%), radial-gradient(at 10% 92%, #8fd8d0 0, transparent 50%), linear-gradient(#dcf5ee, #dcf5ee); --mem-title: #0d4a4c; }
.mem-art-rose { --mem-art: radial-gradient(at 12% 10%, #f8b7ca 0, transparent 52%), radial-gradient(at 88% 12%, #dcc0f4 0, transparent 50%), radial-gradient(at 78% 92%, #ffd6c2 0, transparent 52%), radial-gradient(at 8% 90%, #f4c2e2 0, transparent 50%), linear-gradient(#fbe4ec, #fbe4ec); --mem-title: #6b1740; }
.mem-art-sky { --mem-art: radial-gradient(at 12% 10%, #aed4fb 0, transparent 52%), radial-gradient(at 90% 12%, #cfc8fb 0, transparent 50%), radial-gradient(at 80% 92%, #ffeec6 0, transparent 52%), radial-gradient(at 8% 92%, #bfe3f6 0, transparent 50%), linear-gradient(#e3effd, #e3effd); --mem-title: #1b3a6e; }
.mem-art-linen { --mem-art: radial-gradient(circle, rgba(92, 60, 30, .18) 1px, transparent 1.6px) 0 0 / 22px 22px, linear-gradient(160deg, #fbf6ec, #f1e7d6); --mem-title: #3b2a1b; }

/* ---------- One wall ---------- */

.mem-back { display: inline-flex; gap: 4px; align-items: center; color: var(--mem-soft); font-size: 14px; font-weight: 600; text-decoration: none; }
.mem-back:hover { color: var(--mem-accent); }
.mem-frame { border: 1px solid var(--mem-line); border-radius: 14px; overflow: hidden; background: var(--mem-panel); box-shadow: 0 24px 50px -32px rgba(70, 40, 12, .55); }
.mem-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--mem-line); }
.mem-spacer { flex: 1 1 auto; }
.mem-seg { display: inline-flex; border: 1px solid var(--mem-line); border-radius: 8px; overflow: hidden; }
.mem-seg button { border: 0; background: transparent; padding: 6px 11px; font-size: 13.5px; font-weight: 600; color: var(--mem-soft); cursor: pointer; }
.mem-seg button + button { border-left: 1px solid var(--mem-line); }
.mem-seg button[aria-pressed="true"] { background: var(--mem-strong); color: var(--mem-on-strong); }
.mem-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; background: var(--mem-accent-soft); color: var(--mem-ink); font-size: 13.5px; font-weight: 600; }
.mem-pill svg { width: 15px; height: 15px; flex: none; }

.mem-stage { position: relative; aspect-ratio: 5 / 4; container-type: inline-size; background: var(--mem-art); overflow: hidden; touch-action: pan-y; }
.mem-stage::before { content: ""; position: absolute; inset: 0; background: var(--mem-grain); pointer-events: none; }
.mem-wall-head { position: absolute; left: 3%; right: 3%; top: 3%; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; color: var(--mem-title); }
.mem-wall-head > div { min-width: 0; }
.mem-eyebrow { font-size: 13px; font-weight: 700; opacity: .85; }
.mem-wall-title { font: italic 600 clamp(1.9rem, 5.4cqw, 4rem)/1.05 var(--mem-display); margin: 0; color: var(--mem-title); text-wrap: balance; overflow-wrap: anywhere; }
.mem-page .mem-wall-title { color: var(--mem-title); }
.mem-wall-side { display: grid; justify-items: end; gap: 7px; flex: none; }
.mem-faces { display: flex; }
.mem-face { width: 32px; height: 32px; margin-left: -8px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); color: #fff; font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.mem-face:first-child { margin-left: 0; }
.mem-c0 { background: #b4532a; } .mem-c1 { background: #2f6f94; } .mem-c2 { background: #7451b8; } .mem-c3 { background: #2f7a4d; } .mem-c4 { background: #a8325a; } .mem-c5 { background: #8a6a35; } .mem-c6 { background: #0f7b86; }
.mem-more-faces { background: var(--mem-title); }
.mem-countdown { background: var(--mem-title); color: #fff; border-radius: 999px; padding: 2px 11px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mem-notes { position: absolute; inset: 0; }
.mem-tl-date { grid-column: 1 / -1; font: italic 600 1.35rem/1.2 var(--mem-display); color: var(--mem-title); padding-top: 8px; }
.mem-wall-empty { position: absolute; left: 50%; top: 52%; width: min(82%, 340px); transform: translate(-50%, -50%) rotate(-1.5deg); padding: 26px; text-align: center; background: linear-gradient(160deg, #fff7bd, #ffec94); box-shadow: var(--mem-shadow); color: var(--mem-note-ink); font: 700 1.7rem/1.2 var(--mem-quick); }
.mem-wall-empty .mem-btn { margin-top: 12px; font-family: var(--mem-ui); }

/* Neat and Timeline, and every view on a narrow screen: an ordered flow. */
.mem-stage.mem-flow { aspect-ratio: auto; min-height: 420px; padding: 20px; display: grid; gap: 18px; }
.mem-stage.mem-flow .mem-wall-head, .mem-stage.mem-flow .mem-notes { position: relative; inset: auto; left: auto; right: auto; top: auto; }
.mem-stage.mem-flow .mem-notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 20px 18px; align-items: start; }
.mem-stage.mem-flow .mem-note { position: relative; left: auto !important; top: auto !important; width: auto; font-size: 14.5px; cursor: default; }
.mem-stage.mem-flow .mem-wall-empty { position: relative; left: auto; top: auto; transform: rotate(-1.5deg); margin: 12px auto; }

/* ---------- Notes ---------- */

.mem-note { position: absolute; display: flex; flex-direction: column; gap: .55em; width: 13.5em; min-height: 12.5em; padding: 1.25em 1em .55em; font-size: clamp(11px, 1.42cqw, 17px); color: var(--mem-note-ink); transform: rotate(var(--mem-r, 0deg)); box-shadow: var(--mem-shadow); transition: transform .18s ease, box-shadow .18s ease; cursor: default; user-select: none; }
.mem-note[data-move="1"] { cursor: grab; }
.mem-note:hover, .mem-note:focus-within { transform: rotate(0deg) scale(1.035); z-index: 200 !important; }
.mem-note.is-dragging { transform: rotate(0deg) scale(1.06); cursor: grabbing; box-shadow: 0 30px 40px -18px rgba(70, 40, 12, .6); transition: none; z-index: 300 !important; }
.mem-note::before { content: ""; position: absolute; top: -.6em; left: 50%; width: 5.4em; height: 1.45em; margin-left: -2.7em; transform: rotate(-2deg); background: rgba(255, 255, 255, .58); box-shadow: 0 1px 2px rgba(70, 40, 12, .16); }
.mem-note.mem-deco-pin::before { top: -.5em; width: 1.05em; height: 1.05em; margin-left: -.52em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd2b8, #d4683a 62%); box-shadow: 0 2px 3px rgba(70, 40, 12, .45); transform: none; }
.mem-note.mem-paper::after { content: ""; position: absolute; right: 0; bottom: 0; width: 1.7em; height: 1.7em; background: linear-gradient(315deg, rgba(255, 255, 255, .55) 45%, rgba(70, 40, 12, .16) 50%, transparent 56%); pointer-events: none; }
.mem-p-lemon { background: linear-gradient(165deg, #fff8c2, #ffee97); }
.mem-p-peach { background: linear-gradient(165deg, #ffe3c9, #ffcfa8); }
.mem-p-rose { background: linear-gradient(165deg, #ffe0e8, #ffc7d6); }
.mem-p-mint { background: linear-gradient(165deg, #dcf8e3, #bff0cf); }
.mem-p-sky { background: linear-gradient(165deg, #dcf0ff, #bfe2fb); }
.mem-p-lilac { background: linear-gradient(165deg, #ece4ff, #d8cbfb); }
.mem-p-white { background: linear-gradient(165deg, #ffffff, #f7f1e7); }
.mem-pen-quick { font: 600 1.52em/1.14 var(--mem-quick); }
.mem-pen-neat { font: 400 1.13em/1.28 var(--mem-neat); }
.mem-pen-playful { font: 700 1.28em/1.18 var(--mem-playful); }
.mem-pen-urdu { font: 400 1.04em/2 var(--mem-urdu); direction: rtl; text-align: right; }
.mem-text { flex: 1 1 auto; overflow-wrap: anywhere; white-space: pre-wrap; }
.mem-sticker { position: absolute; right: -.7em; top: -.7em; width: 2.9em; height: 2.9em; transform: rotate(10deg); filter: drop-shadow(0 2px 2px rgba(70, 40, 12, .35)); pointer-events: none; z-index: 2; }
.mem-by { display: flex; align-items: center; gap: .4em; margin-top: auto; font: 400 .78em/1.3 var(--mem-ui); color: var(--mem-note-soft); }
.mem-by b { font-weight: 700; color: #4b3628; }
.mem-by span { margin-left: auto; white-space: nowrap; }
.mem-pinned { position: absolute; left: .85em; top: .35em; z-index: 1; padding: 0 .4em; border-radius: .3em; background: rgba(255, 255, 255, .85); font: 700 .68em/1.4 var(--mem-ui); color: #b4532a; }
.mem-acts { display: flex; align-items: center; gap: .3em; min-height: 1.9em; }
.mem-act { display: inline-flex; align-items: center; gap: .3em; min-height: 1.75em; padding: .12em .42em; border: 0; border-radius: .4em; background: transparent; color: #5c4535; font: 700 .82em/1 var(--mem-ui); font-variant-numeric: tabular-nums; cursor: pointer; }
.mem-act:hover { background: rgba(70, 40, 12, .1); }
.mem-act svg { width: 1.2em; height: 1.2em; }
.mem-act.is-on { color: #c5284f; }
.mem-act.is-on svg { fill: currentColor; }
.mem-acts .mem-act:first-child { margin-right: auto; }
.mem-act-more { opacity: 0; transition: opacity .15s; }
.mem-note:hover .mem-act-more, .mem-note:focus-within .mem-act-more { opacity: 1; }
@media (hover: none) { .mem-act-more { opacity: 1; } }

.mem-k-photo { padding: .65em .65em .45em; background: linear-gradient(170deg, #ffffff, #f8f4ec); }
.mem-pic { aspect-ratio: 1 / .86; overflow: hidden; background: #eee; }
.mem-pic img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.mem-k-photo .mem-pen-quick { font-size: 1.32em; }

/* Something pinned from BooksShore. */
.mem-item { display: grid; grid-template-columns: 2.9em minmax(0, 1fr); gap: .6em; align-items: center; color: var(--mem-note-ink); text-align: left; text-decoration: none; font-family: var(--mem-ui); }
.mem-item:hover { color: var(--mem-note-ink); }
a.mem-item:hover strong { text-decoration: underline; }
.mem-item-img { display: block; width: 2.9em; height: 4.1em; object-fit: cover; border-radius: .14em .3em .3em .14em; background: #7b3b45; box-shadow: 0 2px 4px rgba(70, 40, 12, .35); }
.mem-item-icon { display: grid; place-items: center; color: #fff; font: 700 1.2em/1 var(--mem-display); width: 2.42em; height: 3.42em; }
.mem-item-text { min-width: 0; }
.mem-item strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font: 800 .94em/1.15 var(--mem-display); overflow-wrap: anywhere; }
.mem-item small { display: block; font-size: .72em; line-height: 1.3; color: var(--mem-note-soft); font-weight: 700; }
.mem-item small.mem-item-sub { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-weight: 400; overflow-wrap: anywhere; }
.mem-item-gone { margin: 0; font: italic 400 .76em/1.35 var(--mem-ui); color: var(--mem-note-soft); }

.mem-k-sealed { align-items: center; overflow: hidden; padding-top: 5.1em; text-align: center; background: linear-gradient(170deg, #efddbc, #dfc698); }
.mem-k-sealed::before { top: 0; left: 0; width: 100%; height: 3.2em; margin: 0; transform: none; background: linear-gradient(170deg, #e4cfa8, #d4b985); clip-path: polygon(0 0, 100% 0, 50% 100%); box-shadow: none; }
.mem-wax { position: absolute; top: 1.75em; left: 50%; margin-left: -1.09em; width: 2.18em; height: 2.18em; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 36% 30%, #d9574e, #a8322a 66%); color: #ffe9d8; font: italic 600 1.15em/1 var(--mem-display); box-shadow: 0 2px 4px rgba(70, 40, 12, .45); }
.mem-seal-title { font: 700 1.3em/1.15 var(--mem-quick); }
.mem-seal-sub { font: 400 .76em/1.35 var(--mem-ui); color: #5e4731; }
.mem-seal-words { font: 600 1.15em/1.2 var(--mem-quick); opacity: .85; }
.mem-seal-opened { align-self: flex-start; font: 700 .72em/1.3 var(--mem-ui); color: #7b4a1f; }

/* ---------- Sample walls, for visitors ---------- */

.mem-welcome { padding-top: 22px; }
.mem-hero-second { justify-content: center; padding-block: 11px; }
.mem-samples, .mem-how { display: grid; gap: 14px; min-width: 0; }
.mem-samples .mem-section-title, .mem-how .mem-section-title { margin: 0; }
.mem-sample-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.mem-sample-pick { gap: 12px; min-height: 124px; margin: 0; padding: 12px 14px; cursor: pointer; }
.mem-sample-pick > span { display: block; }
.mem-sample-pick b { font-size: 1.2rem; }
.mem-sample-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mem-sample-pick:has(input:checked) { outline: 3px solid var(--mem-accent); outline-offset: 2px; }
.mem-sample-pick:has(input:focus-visible) { outline: 3px dashed var(--mem-accent); outline-offset: 2px; }
/* Only the chosen wall shows. A browser without :has lists all four. */
@supports selector(:has(a)) {
  .mem-sample { display: none; }
  .mem-samples:has(#mem-pick-birthday:checked) #mem-wall-birthday,
  .mem-samples:has(#mem-pick-trip:checked) #mem-wall-trip,
  .mem-samples:has(#mem-pick-wedding:checked) #mem-wall-wedding,
  .mem-samples:has(#mem-pick-farewell:checked) #mem-wall-farewell { display: block; }
}
.mem-sample .mem-act { cursor: default; }
.mem-sample .mem-act:hover { background: transparent; }
.mem-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; margin: 0; padding: 0 0 0 1.3em; color: var(--mem-soft); }
.mem-steps li::marker { color: var(--mem-accent); font-weight: 800; }
.mem-steps strong { display: block; color: var(--mem-ink); }
.mem-how-cta { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) { .mem-sample-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Dialogs ---------- */

.mem-dialog { width: min(620px, calc(100vw - 24px)); max-height: 92dvh; padding: 0; border: 0; border-radius: 14px; background: var(--mem-panel); color: var(--mem-ink); font-family: var(--mem-ui); box-shadow: 0 30px 70px -20px rgba(40, 20, 5, .6); overflow: auto; }
.mem-dialog-wide { width: min(760px, calc(100vw - 24px)); }
.mem-dialog::backdrop { background: rgba(43, 31, 23, .55); }
.mem-dlg { display: grid; gap: 14px; padding: 20px; }
.mem-dlg > * { min-width: 0; }
.mem-dlg h2 { margin: 0; font: 800 1.5rem/1.2 var(--mem-display); color: inherit; }
.mem-hint { margin: 0; color: var(--mem-soft); font-size: 13.5px; }
.mem-error { margin: 0; color: #b3261e; font-size: 14px; font-weight: 600; }
[data-blog-theme="dark"] .mem-error { color: #f2998f; }
.mem-field { display: grid; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.mem-field > label, .mem-field > legend, .mem-lab { padding: 0; font-size: 13px; font-weight: 700; color: var(--mem-soft); }
.mem-field > legend { float: none; width: auto; margin: 0 0 4px; }
.mem-field input[type=text], .mem-field input[type=date], .mem-field input[type=search], .mem-field textarea { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--mem-line); border-radius: 8px; background: var(--mem-field); color: var(--mem-ink); }
.mem-field textarea { min-height: 76px; resize: vertical; }
.mem-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mem-chip { display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 4px 12px; border: 1px solid var(--mem-line); border-radius: 999px; background: var(--mem-field); color: var(--mem-ink); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.mem-chip:has(input:checked), .mem-chip[aria-pressed="true"] { background: var(--mem-strong); border-color: var(--mem-strong); color: var(--mem-on-strong); }
.mem-chip:has(input:focus-visible) { outline: 2px solid var(--mem-accent); outline-offset: 2px; }
.mem-chip input, .mem-swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mem-chip img { display: block; width: 22px; height: 22px; }
.mem-pick-quick { font: 700 17px/1.3 var(--mem-quick); }
.mem-pick-neat { font: 400 14px/1.5 var(--mem-neat); }
.mem-pick-playful { font: 700 15px/1.4 var(--mem-playful); }
.mem-swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.mem-swatch { display: block; width: 28px; height: 28px; margin: 0; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--mem-line); cursor: pointer; }
.mem-swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--mem-strong); }
.mem-swatch:has(input:focus-visible) { outline: 2px solid var(--mem-accent); outline-offset: 3px; }
.mem-check { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 14px; }
.mem-check input { margin-top: 3px; flex: none; }
.mem-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.mem-foot-apart { justify-content: space-between; }
.mem-compose { display: grid; grid-template-columns: minmax(0, 1fr) 215px; gap: 18px; align-items: start; }
.mem-compose > div { display: grid; gap: 12px; min-width: 0; }
.mem-note-preview { display: grid; place-items: center; padding: 24px 14px; border-radius: 10px; background: var(--mem-art); }
.mem-note-preview .mem-note { position: relative; width: 12em; font-size: 14px; }
.mem-note-preview .mem-note:hover { transform: rotate(var(--mem-r, 0deg)); }

/* Pin from BooksShore, in the note form. */
.mem-pinbox { display: grid; gap: 8px; min-width: 0; }
.mem-pin-open { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 1px dashed var(--mem-line); border-radius: 8px; background: var(--mem-field); color: var(--mem-ink); font-size: 14px; font-weight: 700; text-align: left; cursor: pointer; }
.mem-pin-open:hover { border-color: var(--mem-accent); }
.mem-pin-open svg { width: 20px; height: 20px; flex: none; color: var(--mem-accent); }
.mem-pin-open small { display: block; color: var(--mem-soft); font-size: 12.5px; font-weight: 400; }
.mem-pin-chosen { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--mem-accent); border-radius: 8px; background: var(--mem-accent-soft); }
.mem-pin-chosen[hidden], .mem-pin-open[hidden], .mem-pin-panel[hidden] { display: none; }
.mem-pin-chosen-text { flex: 1 1 auto; min-width: 0; }
.mem-pin-chosen small { display: block; color: var(--mem-soft); font-size: 12px; font-weight: 700; }
.mem-pin-chosen strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.mem-pin-panel { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--mem-line); border-radius: 8px; }
.mem-pin-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.mem-pin-tab { padding: 3px 10px; border: 1px solid var(--mem-line); border-radius: 999px; background: var(--mem-field); color: var(--mem-ink); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.mem-pin-tab[aria-selected="true"] { background: var(--mem-strong); border-color: var(--mem-strong); color: var(--mem-on-strong); }
.mem-pin-q { width: 100%; min-width: 0; padding: 7px 10px; border: 1px solid var(--mem-line); border-radius: 8px; background: var(--mem-field); color: var(--mem-ink); }
.mem-pin-results { display: grid; gap: 4px; max-height: 210px; overflow: auto; color: var(--mem-soft); font-size: 13.5px; }
.mem-pin-result { display: block; width: 100%; padding: 5px 8px; border: 1px solid var(--mem-line); border-radius: 8px; background: #fffdf9; font-size: 14px; cursor: pointer; }
.mem-pin-result:hover { border-color: var(--mem-accent); }

.mem-code { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.mem-code span { display: grid; place-items: center; width: 46px; height: 58px; border: 1px solid var(--mem-line); border-radius: 8px; background: var(--mem-accent-soft); font: 800 1.7rem/1 var(--mem-display); font-variant-numeric: lining-nums; }
.mem-link-box { display: block; padding: 7px 10px; border-radius: 8px; background: var(--mem-field); border: 1px solid var(--mem-line); font-size: 13px; color: var(--mem-soft); overflow-wrap: anywhere; user-select: all; }
.mem-people { display: grid; gap: 2px; max-height: 240px; overflow: auto; }
.mem-person { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.mem-person .mem-face { margin: 0; border: 0; }
.mem-person form { margin: 0 0 0 auto; }
.mem-linkbtn { padding: 0; border: 0; background: transparent; color: var(--mem-accent); font-size: 13px; font-weight: 700; cursor: pointer; }

.mem-share { display: grid; grid-template-columns: 185px minmax(0, 1fr); gap: 18px; align-items: start; }
.mem-share > div { min-width: 0; }
.mem-share-opts { display: grid; gap: 14px; }
.mem-share-view { display: grid; place-items: center; min-height: 240px; padding: 14px; border-radius: 10px; background: var(--mem-accent-soft); }
.mem-share-view canvas { display: block; max-width: 100%; max-height: 62dvh; width: auto; height: auto; box-shadow: 0 16px 26px -14px rgba(40, 20, 5, .6); }
.mem-wave-box { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--mem-line); border-radius: 10px; }

#mem-toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 2000; max-width: calc(100vw - 32px); padding: 8px 16px; border-radius: 8px; transform: translateX(-50%); background: #2b1f17; color: #fff; font: 600 14px/1.4 var(--mem-ui); box-shadow: 0 10px 24px -8px rgba(40, 20, 5, .6); }
#mem-toast a { color: #ffd2b8; }

@media (max-width: 900px) {
  .mem-stage { aspect-ratio: auto; min-height: 420px; padding: 18px 14px; display: grid; gap: 18px; }
  .mem-wall-head, .mem-notes { position: relative; inset: auto; left: auto; right: auto; top: auto; }
  .mem-notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 18px 14px; align-items: start; }
  .mem-stage .mem-note { position: relative; left: auto !important; top: auto !important; width: auto; font-size: 13.5px; cursor: default; }
  .mem-wall-empty { position: relative; left: auto; top: auto; transform: rotate(-1.5deg); margin: 12px auto; }
}
@media (max-width: 640px) {
  .mem-hero, .mem-compose, .mem-share, .mem-steps { grid-template-columns: minmax(0, 1fr); }
  .mem-note-preview { order: -1; }
  .mem-wall-head { flex-wrap: wrap; }
  .mem-wall-side { justify-items: start; }
  .mem-code span { width: 40px; height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  .mem-note, .mem-tile, .mem-act-more { transition: none; }
}
