/* The homepage's drawings of the write screen as it is now (the page, since
 * 2026-11-11): one dark page, the chapter's name in Lora at its top, the
 * words and Aa on the right, paragraphs of prose, and the focused paragraph's
 * actions in the margin — round icons, the name sliding out — with the steer
 * box and the AI's progress line above it. Every homepage animation draws
 * from this kit (`.pm-*`), so they all look like the app. No beat cards,
 * no commit. The app's own rules: src/lib/ui/page-editor.css, page-top.css.
 */
.pm {
  --pm-btn: 30px;
  --pm-gutter: 50px;
  --pm-face:
    radial-gradient(140% 120% at 0% 0%, rgba(240, 106, 155, 0.09), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 45%, var(--bg-deep)) 100%);
  position: relative;
  border-radius: 22px;
  padding: 22px 26px 26px calc(var(--pm-gutter) + 8px);
  background:
    radial-gradient(90% 60% at 100% 0%, rgba(167, 139, 250, 0.10), transparent 60%),
    radial-gradient(80% 60% at 0% 100%, rgba(240, 106, 155, 0.08), transparent 60%),
    linear-gradient(180deg, #17141b, #110f14);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 var(--hairline),
    0 40px 90px -40px rgba(0, 0, 0, 0.95),
    0 0 120px -40px rgba(240, 106, 155, 0.35);
  color: var(--fg);
  text-align: left;
  user-select: none;
  overflow: hidden;
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .pm {
    --pm-face: radial-gradient(140% 120% at 0% 0%, rgba(240, 106, 155, 0.09), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, rgba(calc(var(--surface__r) * 0.45 + var(--bg-deep__r) * 0.55), calc(var(--surface__g) * 0.45 + var(--bg-deep__g) * 0.55), calc(var(--surface__b) * 0.45 + var(--bg-deep__b) * 0.55), calc(var(--surface__a) * 0.45 + var(--bg-deep__a) * 0.55)) 100%);
  }
}
/* The window's three dots: it reads as the app at a glance. */
.pm-dots { position: absolute; top: 14px; left: 16px; display: flex; gap: 6px; }
.pm-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }

/* The page's top: the chapter, then the words and Aa. */
.pm-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}
.pm-chap { font-family: var(--font-display); font-size: calc(21px / var(--tz, 1)); font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pm-meta { display: flex; align-items: center; gap: 12px; flex: none; font-size: calc(12px / var(--tz, 1)); color: var(--fg-3); }
.pm-meta b { color: var(--fg-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.pm-words { display: inline-block; }
.pm-words.bump { animation: pm-bump 0.6s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pm-bump { 40% { transform: scale(1.15); color: var(--accent-text); } }
.pm-aa { font-family: var(--font-display); font-size: calc(13px / var(--tz, 1)); color: var(--fg-2); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }

/* A paragraph: its text, the thin line down its left edge when it's the
   one being worked on (rose and breathing while the AI writes). */
.pm-para { position: relative; margin: 0 0 14px; transition: margin 0.45s cubic-bezier(.2, .8, .2, 1); }
.pm-text {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-size: calc(15px / var(--tz, 1));
  line-height: 1.72;
  color: var(--fg);
  min-height: 1.72em;
  text-wrap: pretty;
}
.pm-text::before {
  content: "";
  position: absolute;
  top: 3px; bottom: 3px; left: -10px;
  width: 1px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.25s, box-shadow 0.25s;
}
.pm-para.is-active .pm-text::before { background: rgba(255, 255, 255, 0.22); }
.pm-para.is-running .pm-text::before {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(240, 106, 155, 0.6);
  animation: pm-breathe 1.8s ease-in-out infinite;
}
@keyframes pm-breathe { 50% { opacity: 0.45; } }
/* The writer's own draft: the prose colour with the faintest rose. */
.pm-text.is-draft { color: #f1dbe3; }
.pm-text .pm-w { animation: pm-w 0.5s ease-out both; }
@keyframes pm-w { from { opacity: 0; filter: blur(5px); } }
.pm-text .pm-new { border-radius: 3px; background: rgba(240, 106, 155, 0.16); box-shadow: 0 0 0 2px rgba(240, 106, 155, 0.16); transition: background 1.6s, box-shadow 1.6s; }
.pm-text .pm-new.settled { background: transparent; box-shadow: 0 0 0 2px transparent; }
.pm-dash { position: absolute; left: calc(var(--pm-gutter) * -1 + 12px); top: 0.86em; width: 7px; height: 1px; background: var(--border-strong); }
.pm-caret { display: inline-block; width: 1.5px; height: 1.05em; margin-left: 1px; vertical-align: -0.17em; background: var(--accent); animation: pm-blink 0.9s steps(1) infinite; }
@keyframes pm-blink { 50% { opacity: 0; } }

/* The margin: the focused paragraph's actions, stacked, round icons. */
.pm-rail {
  position: absolute;
  left: calc(var(--pm-gutter) * -1);
  top: 2px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.22s, transform 0.22s cubic-bezier(.2, .9, .3, 1.1);
  pointer-events: none;
}
.pm-para.has-rail .pm-rail { opacity: 1; transform: none; }
.pm-btn {
  height: var(--pm-btn);
  min-width: var(--pm-btn);
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--pm-face);
  box-shadow: inset 0 1px 0 var(--hairline), 0 10px 24px -16px rgba(0, 0, 0, 0.9);
  color: var(--fg-2);
  font-size: calc(12px / var(--tz, 1));
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.2s;
}
.pm-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pm-btn-label { max-width: 0; overflow: hidden; opacity: 0; transition: max-width 0.22s ease, opacity 0.16s, margin 0.22s; }
.pm-btn.is-hover { color: var(--fg); border-color: var(--border-strong); }
.pm-btn.is-hover .pm-btn-label { max-width: 120px; opacity: 1; margin: 0 4px 0 6px; }
.pm-btn.is-press { transform: scale(0.92); box-shadow: 0 0 0 5px rgba(240, 106, 155, 0.18); }
.pm-btn.is-on { color: var(--accent-text); border-color: var(--accent-border); }
.pm-btn.is-spark { color: var(--spark-text); border-color: rgba(167, 139, 250, 0.45); }

/* Above the paragraph: the AI's progress line, or the steer box — the
   sidebar's face, a pill the width of the page. */
.pm-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 0;
  margin: 0 0 0 0;
  padding: 0 6px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--pm-face);
  font-size: calc(12.5px / var(--tz, 1));
  font-weight: 600;
  color: var(--fg-2);
  opacity: 0;
  transform-origin: 0 50%;
  transform: scaleX(0.15);
  transition: height 0.4s cubic-bezier(.2, .8, .2, 1), margin 0.4s cubic-bezier(.2, .8, .2, 1), opacity 0.3s, transform 0.45s cubic-bezier(.2, .9, .25, 1), border-color 0.3s;
}
.pm-box.is-open { height: 38px; margin-bottom: 10px; opacity: 1; transform: none; border-color: var(--border); box-shadow: inset 0 1px 0 var(--hairline), 0 12px 28px -18px rgba(0, 0, 0, 0.9); }
.pm-box-label { flex: none; padding-right: 10px; border-right: 1px solid rgba(240, 106, 155, 0.3); font-size: calc(10.5px / var(--tz, 1)); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); line-height: 16px; }
.pm-box-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--fg); font-weight: 500; }
.pm-go { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(180deg, #f27aa6, #d94d82); color: #fff; transition: transform 0.12s, box-shadow 0.2s; }
.pm-go svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pm-go.is-press { transform: scale(0.88); box-shadow: 0 0 0 5px rgba(240, 106, 155, 0.25); }
.pm-spin { flex: none; width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: var(--accent); animation: pm-spin 0.8s linear infinite; }
@keyframes pm-spin { to { transform: rotate(360deg); } }
.pm-box.is-progress { color: #fff; }

/* The pointer: a person using the app. */
.pm-cursor {
  position: absolute;
  left: 0; top: 0;
  z-index: 9;
  width: 18px; height: 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
}
.pm-cursor.is-on { opacity: 1; }
.pm-cursor svg { width: 100%; height: 100%; }
.pm-ripple { position: absolute; z-index: 8; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 2px solid rgba(255, 157, 192, 0.8); pointer-events: none; }

@media (max-width: 720px) {
  .pm { --pm-gutter: 42px; --pm-btn: 28px; padding: 18px 16px 18px calc(var(--pm-gutter) + 4px); border-radius: 18px; }
  .pm-chap { font-size: calc(18px / var(--tz, 1)); }
  .pm-text { font-size: calc(14px / var(--tz, 1)); }
  .pm-dots { display: none; }
  .pm-top { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pm *, .pm *::before { animation: none !important; transition: none !important; }
}

/* Sepia: the app's own Sepia page (Aa → Sepia; src/lib/ui/page-top.css),
   its tokens redefined so every piece of the kit takes the light. The SAME
   values as the app's — every text colour 4.5:1 or more (WCAG AA), the
   draft 7:1; tests/demo-colors.test.mjs fails when the two drift apart. The
   guides' hero and mid card use this kit too (site.css .gp-*, linked on
   guide pages): keep it in step with the app. */
.pm.pm-sepia {
  --fg: #3a2f22;
  --fg-2: #4a3d2d;
  --fg-soft: #5b4b38;
  --fg-3: #5e4e3b;
  --fg-4: #705d46;
  --ok: #1f6e37;
  --warn: #8a5410;
  --surface: #fbf4e6;
  --bg-deep: #eadcc3;
  --border: rgba(80, 60, 30, 0.16);
  --border-strong: rgba(80, 60, 30, 0.26);
  --hairline: #fffaf0;
  --accent-text: #a8285a;
  --accent-border: rgba(194, 58, 108, 0.38);
  --spark-text: #6a3fc4;
  --pm-face:
    radial-gradient(140% 120% at 0% 0%, rgba(240, 106, 155, 0.07), transparent 60%),
    linear-gradient(180deg, #fdf8ee 0%, #f3e7d2 100%);
  background:
    radial-gradient(90% 60% at 100% 0%, rgba(255, 255, 255, 0.55), transparent 60%),
    linear-gradient(180deg, #f6eddc, #f0e4cd);
  border-color: rgba(255, 240, 210, 0.5);
  box-shadow:
    inset 0 1px 0 #fffaf0,
    0 40px 90px -40px rgba(0, 0, 0, 0.95),
    0 0 120px -30px rgba(240, 106, 155, 0.4);
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .pm.pm-sepia {
    --fg__r: 58;
    --fg__g: 47;
    --fg__b: 34;
    --fg__a: 1;
    --fg-2__r: 74;
    --fg-2__g: 61;
    --fg-2__b: 45;
    --fg-2__a: 1;
    --fg-soft__r: 91;
    --fg-soft__g: 75;
    --fg-soft__b: 56;
    --fg-soft__a: 1;
    --fg-3__r: 94;
    --fg-3__g: 78;
    --fg-3__b: 59;
    --fg-3__a: 1;
    --fg-4__r: 112;
    --fg-4__g: 93;
    --fg-4__b: 70;
    --fg-4__a: 1;
    --ok__r: 31;
    --ok__g: 110;
    --ok__b: 55;
    --ok__a: 1;
    --warn__r: 138;
    --warn__g: 84;
    --warn__b: 16;
    --warn__a: 1;
    --surface__r: 251;
    --surface__g: 244;
    --surface__b: 230;
    --surface__a: 1;
    --bg-deep__r: 234;
    --bg-deep__g: 220;
    --bg-deep__b: 195;
    --bg-deep__a: 1;
    --border__r: 80;
    --border__g: 60;
    --border__b: 30;
    --border__a: 0.16;
    --border-strong__r: 80;
    --border-strong__g: 60;
    --border-strong__b: 30;
    --border-strong__a: 0.26;
    --hairline__r: 255;
    --hairline__g: 250;
    --hairline__b: 240;
    --hairline__a: 1;
    --accent-text__r: 168;
    --accent-text__g: 40;
    --accent-text__b: 90;
    --accent-text__a: 1;
    --accent-border__r: 194;
    --accent-border__g: 58;
    --accent-border__b: 108;
    --accent-border__a: 0.38;
    --spark-text__r: 106;
    --spark-text__g: 63;
    --spark-text__b: 196;
    --spark-text__a: 1;
  }
}
.pm-sepia .pm-dots i { background: rgba(80, 60, 30, 0.22); }
.pm-sepia .pm-btn { box-shadow: inset 0 1px 0 #fffaf0, 0 8px 18px -12px rgba(80, 55, 20, 0.35); }
.pm-sepia .pm-box.is-open { box-shadow: inset 0 1px 0 #fffaf0, 0 8px 18px -12px rgba(80, 55, 20, 0.35); }
.pm-sepia .pm-box.is-progress, .pm-sepia .pm-box { color: var(--fg); }
.pm-sepia .pm-spin { border-color: rgba(60, 50, 40, 0.18); border-top-color: var(--accent); }
.pm-sepia .pm-para.is-active .pm-text::before { background: rgba(60, 50, 40, 0.28); }
.pm-sepia .pm-text.is-draft { color: #554634; }
.pm-sepia .pm-text .pm-new { background: rgba(240, 106, 155, 0.18); box-shadow: 0 0 0 2px rgba(240, 106, 155, 0.18); }
.pm-sepia .pm-text .pm-new.settled { background: transparent; box-shadow: 0 0 0 2px transparent; }
.pm-sepia .pm-dash { background: rgba(60, 50, 40, 0.25); }
.pm-sepia .pm-cursor svg path { fill: #1b1720; stroke: #fff; }

/* Shared (added with KudoAI's section): the writer's IDEA — once a yellow
   sticky note, since 2026-11-16 (notes went from the app: the idea goes into
   the Bible, In mind shows it) an idea card in the Bible's look: rose-tinted
   paper, a fine rose rim, a soft glow, and an "In your Bible" pill with the
   book-and-spark icon. Every text colour 4.5:1 or more on its ground. */
.pm-para.is-note .pm-text {
  position: relative;
  padding: 12px 16px 14px 18px;
  font-family: var(--font-ui);
  font-size: calc(13px / var(--tz, 1));
  line-height: 1.55;
  color: #3a1f2b;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(196, 167, 255, 0.22) 0%, rgba(196, 167, 255, 0) 55%),
    linear-gradient(160deg, #fffafc 0%, #fbe6ee 100%);
  border: 1px solid rgba(214, 90, 140, 0.28);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 26px -12px rgba(176, 42, 92, 0.45), 0 0 0 4px rgba(240, 106, 155, 0.06);
}
.pm-para.is-note .pm-text::before {
  content: "";
  display: block;
  position: absolute;
  left: 7px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #f06a9b, #a78bfa);
}
.pm-note-tag {
  position: absolute;
  right: 12px;
  bottom: -10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: calc(10.5px / var(--tz, 1));
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #c2336d, #8f2a9e);
  box-shadow: 0 4px 12px -4px rgba(176, 42, 92, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  white-space: nowrap;
}
.pm-note-tag::before {
  content: "";
  width: 11px;
  height: 11px;
  flex: none;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 5.5A1.5 1.5 0 0 1 7 4h9.5v13.5H7A1.5 1.5 0 0 0 5.5 19V5.5zM5.5 19A1.5 1.5 0 0 0 7 20.5h10.5'/%3E%3Cpath d='M11 7.6c.3 1.6 1 2.3 2.6 2.6-1.6.3-2.3 1-2.6 2.6-.3-1.6-1-2.3-2.6-2.6 1.6-.3 2.3-1 2.6-2.6z'/%3E%3C/svg%3E");
}

.pm-para.is-note { margin-bottom: 18px; }

/* A filled shape inside a line icon (Expand's play triangle). */
.pm-ico .is-fill { fill: currentColor; stroke: none; }
