/* ── paste page: idle, drag, processing ─────────────────── */
body.idle #toolbar, body.idle #toc, body.idle #toc-backdrop, body.idle main { display: none; }
body:not(.idle) #paste { display: none; }
body.working #paste { opacity: .2; }

#paste {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 5rem 1.5rem 0;
}
.orn { color: var(--accent); font-size: 1.15rem; opacity: .85; margin-bottom: 1.4rem; }
.wordmark {
  font-size: 3.1rem; line-height: 1; letter-spacing: -.03em; font-weight: 500; margin: 0;
}
.tagline { margin: .95rem 0 0; font-size: 1.15rem; color: var(--ink-soft); text-align: center; text-wrap: pretty; }

.dropzone {
  position: relative; width: min(44rem, 100%); margin: 3.6rem 0 0;
  border: 1.5px dashed var(--border); border-radius: 16px;
  padding: 5.2rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  transition: border-color .28s ease;
}
.dropzone::after {
  content: ''; position: absolute; inset: -1.5px;
  border: 1.5px dashed var(--accent); border-radius: 16px;
  background: var(--accent-soft); pointer-events: none;
  opacity: 0; transition: opacity .24s ease;
}
body.dragging .dropzone::after { opacity: 1; }
.cue {
  position: relative; display: flex; align-items: baseline; gap: .7rem;
  font-size: 2.3rem; line-height: 1.1; letter-spacing: -.015em;
}
.cue .keys { display: inline-flex; gap: .32rem; }
.cue kbd {
  font-family: var(--mono); font-size: .92rem; line-height: 1;
  padding: .45rem .6rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--ink-soft); transform: translateY(-.35rem);
}
.dz-sub { position: relative; margin: 0; font-family: var(--sans); font-size: .9rem; color: var(--muted); text-align: center; }

.assurance {
  display: flex; align-items: center; gap: .6rem;
  margin: 1.9rem 0 0; max-width: 44rem;
}
.assurance .shield { width: 1.05rem; height: 1.05rem; color: var(--accent); flex: none; }
.assurance p { margin: 0; font-size: 1rem; line-height: 1.6; color: var(--ink-soft); text-wrap: pretty; }

.paste-error {
  margin: 1.6rem 0 0; font-size: 1rem; color: var(--ink-soft); font-style: italic;
  opacity: 0; transition: opacity .3s ease; text-align: center; max-width: 34rem;
}
.paste-error.show { opacity: 1; }

.spacer { flex: 1; min-height: 4rem; }
.paste-foot {
  width: 100%; max-width: 44rem;
  display: flex; align-items: center; justify-content: flex-end; gap: 1rem;
  padding: 1.6rem 0 2rem;
  font-family: var(--sans); font-size: .82rem; color: var(--muted);
}
.paste-foot a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--border); }
.paste-foot a:hover { color: var(--accent); border-color: var(--accent); }
.paste-foot button {
  display: flex; align-items: center; gap: .5rem;
  height: 2.1rem; padding: 0 .9rem;
  background: transparent; border: 1px solid var(--border); border-radius: 99px;
  cursor: pointer; color: var(--muted);
  font-family: var(--sans); font-size: .78rem; letter-spacing: .04em;
  transition: color .2s, border-color .2s;
}
.paste-foot button:hover { color: var(--ink); border-color: var(--muted); }

/* ── processing: setting the page ───────────────────────── */
#setting { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; padding: 2rem; background: var(--bg); }
body.working #setting { display: grid; }
.setting-inner { width: min(38rem, 100%); display: flex; flex-direction: column; align-items: center; gap: 2.4rem; }
.setting-orn { color: var(--accent); font-size: 1.6rem; animation: breathe .78s cubic-bezier(.22,.61,.36,1) both; }
.skeleton { width: 100%; display: flex; flex-direction: column; gap: .85rem; animation: lines-out .3s ease-in .52s both; }
.skeleton i { display: block; height: .62rem; border-radius: 3px; background: var(--surface-2); animation: line .34s cubic-bezier(.22,.61,.36,1) both; }
.skeleton i:nth-child(1) { width: 42%;  animation-delay: .02s; }
.skeleton i:nth-child(2) { width: 100%; animation-delay: .09s; }
.skeleton i:nth-child(3) { width: 96%;  animation-delay: .15s; }
.skeleton i:nth-child(4) { width: 99%;  animation-delay: .21s; }
.skeleton i:nth-child(5) { width: 64%;  animation-delay: .27s; }
.setting-label { font-family: var(--sans); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

@keyframes line { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes lines-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes breathe { 0% { opacity: 0; transform: scale(.94); } 45% { opacity: 1; transform: scale(1.05); } 100% { opacity: .9; transform: scale(1) translateY(-6px); } }

@media (prefers-reduced-motion: reduce) {
  .setting-orn, .skeleton, .skeleton i { animation: none; opacity: 1; transform: none; }
  #progress { transition: none; }
}

/* close button lives in the reader toolbar on the web build */
#btn-close { width: auto !important; padding: 0 .8rem; font-family: var(--sans); font-size: .72rem !important; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ── example link ───────────────────────────────────────── */
.example-line { margin: 1.4rem 0 0; font-family: var(--sans); font-size: .9rem; color: var(--muted); }
.example-line button {
  appearance: none; border: 0; background: none; padding: 0;
  font: inherit; color: var(--ink-soft); cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.example-line button:hover { color: var(--accent); border-color: var(--accent); }

/* ── below the fold: why ────────────────────────────────── */
.why {
  width: min(38rem, 100%);
  margin: 0 auto;
  padding: 1rem 0 6rem;
  color: var(--ink-soft);
}
.why h2 {
  font-family: var(--sans);
  font-size: .74rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted);
  margin: 3.4rem 0 1rem;
}
.why h2:first-child { margin-top: 0; }
.why p { margin: 0 0 1.25rem; font-size: 1.02rem; line-height: 1.75; text-wrap: pretty; }
.why code {
  font-family: var(--mono); font-size: .86em;
  background: var(--surface-2); padding: .1em .35em; border-radius: 4px;
}
.why-foot { color: var(--muted); font-size: .95rem !important; }
.why-foot a { color: inherit; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }
.why-foot a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ── feather mark ───────────────────────────────────────── */
/* The source artwork sits in one corner of an 800x600 viewBox; the symbol is
   cropped to its real bounds, so these widths are the feather itself. */
/* Explicit height: an auto-height SVG in a flex row resolves tall and then
   centres the artwork inside it, which floats the mark below its heading. */
.feather { width: 30px; height: 68px; color: var(--accent); display: block; flex: none; }
.feather-sm { width: 22px; height: 50px; align-self: flex-start; }
#paste .orn { margin-bottom: 1.1rem; display: grid; place-items: center; }

/* ── library (multi-document gallery) ───────────────────── */
body.library #toolbar, body.library #toc, body.library #toc-backdrop,
body.library main, body.library #paste { display: none; }
body:not(.library) #library { display: none; }
#library[hidden] { display: none !important; }

#library { max-width: 64rem; margin: 0 auto; padding: 4.5rem 1.5rem 6rem; }
.lib-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2.4rem;
}
.lib-title { display: flex; align-items: flex-start; gap: .85rem; }
.lib-title h2 { font-size: 1.5rem; font-weight: 500; letter-spacing: -.015em; margin: 0; }
.lib-sub { margin: .3rem 0 0; font-family: var(--sans); font-size: .84rem; color: var(--muted); }
/* style.css scopes its button reset to "#toolbar button", so the gallery's own
   toolbar has to restate it or the browser default shows through. */
.lib-tools button {
  appearance: none; border: 0; background: transparent;
  color: var(--ink-soft);
  font-family: var(--sans); font-size: .75rem; letter-spacing: .04em;
  height: 2.1rem; padding: 0 .9rem;
  display: grid; place-items: center;
  border-radius: 99px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.lib-tools button:hover { background: var(--surface-2); color: var(--ink); }
.lib-tools button:has(svg), .lib-tools button:has(span.a-small),
.lib-tools button:has(span.a-large), .lib-tools button:has(span.ff) { width: 2.1rem; padding: 0; }
.lib-tools button svg { width: 1.05rem; height: 1.05rem; }
.lib-tools .sep { width: 1px; height: 1.1rem; background: var(--border); margin: 0 .15rem; }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 1.7rem; }
.card {
  position: relative; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; cursor: pointer; padding: 0;
  font: inherit; color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--muted); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-preview {
  position: relative; height: 9.5rem; overflow: hidden;
  background: var(--bg); padding: 1rem 1.1rem;
  font-size: .56rem; line-height: 1.55; color: var(--ink-soft);
}
.card-preview::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4rem;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.card-preview h4 { font-size: .8rem; margin: 0 0 .45rem; font-weight: 600; color: var(--ink); }
.card-body { padding: .85rem 1.1rem 1rem; border-top: 1px solid var(--border); }
.card-title { font-size: 1.02rem; line-height: 1.35; margin: 0; text-wrap: pretty; }
.card-meta { font-family: var(--sans); font-size: .74rem; color: var(--muted); margin: .35rem 0 0; }
.card-share {
  position: absolute; top: .6rem; right: .6rem; z-index: 2;
  width: 1.75rem; height: 1.75rem; border-radius: 99px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-soft); cursor: pointer; font-size: .8rem;
  opacity: 0; transition: opacity .18s ease, color .18s ease;
}
.card:hover .card-share, .card-share:focus-visible { opacity: 1; }
.card-share:hover { color: var(--accent); }

/* drag veil, shared by idle and library */
#dropveil {
  position: fixed; inset: 1.1rem; z-index: 60; pointer-events: none;
  border: 1.5px dashed var(--accent); border-radius: 16px;
  background: var(--accent-soft); opacity: 0; transition: opacity .2s ease;
}
body.dragging.library #dropveil, body.dragging:not(.idle) #dropveil { opacity: 1; }

/* ── document switcher ──────────────────────────────────── */
#switcher { display: inline-flex; align-items: center; gap: .1rem; }
#switcher[hidden] { display: none; }
#switch-pos { font-family: var(--mono); font-size: .72rem; color: var(--muted); padding: 0 .25rem; }
#btn-prev.off, #btn-next.off { opacity: .3; cursor: default; }

/* ── share pill ─────────────────────────────────────────── */
/* Full-width layer with the pill centred inside it. A fixed shrink-to-fit box
   positioned from a 50% left edge caps at half the viewport and wraps. */
#sharelayer {
  position: fixed; left: 0; right: 0; bottom: 1.8rem; z-index: 90;
  display: flex; justify-content: center; pointer-events: none;
}
.sharepill {
  display: flex; align-items: center; gap: .6rem;
  white-space: nowrap; max-width: calc(100vw - 3rem); overflow: hidden;
  padding: .6rem 1.1rem;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 99px; box-shadow: var(--shadow);
  font-family: var(--sans); font-size: .82rem;
  opacity: 0; transform: translateY(6px);
  transition: opacity .28s ease, transform .28s ease;
}
.sharepill.show { opacity: 1; transform: none; }
.sp-icon { color: var(--accent); }
.sp-label { color: var(--ink); }
.sp-link { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); }
.sp-div { width: 1px; height: 1rem; background: var(--border); }
.sp-note { color: var(--muted); }

/* ── share confirmation ─────────────────────────────────── */
#confirm { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(3px); }
#confirm[hidden] { display: none; }
.confirm-box {
  width: min(30rem, calc(100vw - 3rem));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); padding: 1.9rem;
}
.confirm-box h2 { font-size: 1.25rem; font-weight: 500; margin: 0 0 .8rem; letter-spacing: -.01em; }
.confirm-box p { margin: 0; font-size: .98rem; line-height: 1.65; color: var(--ink-soft); }
.confirm-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.6rem; }
.confirm-actions button {
  font-family: var(--sans); font-size: .85rem; padding: .55rem 1.1rem;
  border-radius: 99px; cursor: pointer; border: 1px solid var(--border);
}
.confirm-actions .ghost { background: transparent; color: var(--ink-soft); }
.confirm-actions .ghost:hover { color: var(--ink); border-color: var(--muted); }
.confirm-actions .primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.confirm-actions .primary:hover { filter: brightness(1.08); }

@media (prefers-reduced-motion: reduce) {
  .card, .sharepill { transition: opacity .2s ease; }
  .card:hover { transform: none; }
}

/* ── split offer ────────────────────────────────────────── */
.splitbar {
  position: fixed; left: 50%; transform: translate(-50%, 8px);
  bottom: 1.8rem; z-index: 85;
  display: flex; align-items: center; gap: .8rem; white-space: nowrap;
  max-width: calc(100vw - 3rem);
  padding: .55rem .6rem .55rem 1.1rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 99px; box-shadow: var(--shadow);
  font-family: var(--sans); font-size: .82rem; color: var(--ink-soft);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.splitbar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.splitbar button {
  font: inherit; font-size: .78rem; padding: .35rem .9rem; border-radius: 99px;
  background: var(--accent); color: var(--bg); border: 0; cursor: pointer;
}
.splitbar button:hover { filter: brightness(1.08); }

/* shared-gallery cards are links, not buttons */
a.card { display: block; text-decoration: none; color: inherit; }
.share-set .back { font-family: var(--sans); }
