/* New Page drafts (B67, Oct 31, 2026): the drafts sheet that opens over New
   Page when you have saved drafts, the "drafts are full" sheet, and the
   delete prompt. Phone website; desktop gets its own layout later. */

.np-dr-dim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 9990;
  animation: npDrFade .2s ease;
}

.np-dr-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: calc(var(--sb-vvh, 100dvh) - 120px);
  background: var(--th-bg-ffffff-up);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .14);
  z-index: 9991;
  display: flex;
  flex-direction: column;
  font-family: 'Poppins', sans-serif;
  color: var(--th-fg-18181b);
  animation: npDrUp .32s cubic-bezier(.32, .72, 0, 1);
  transition: transform .2s ease;
}

.np-dr-sheet.np-dr-top { z-index: 9993; }

.np-dr-handle-row {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: none;
}

.np-dr-handle {
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--th-bg-d6d6de);
}

.np-dr-body {
  overflow-y: auto;
  /* Room so the last row scrolls clear of Safari's floating address bar */
  padding: 4px 16px 104px;
  -webkit-overflow-scrolling: touch;
}

.np-dr-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 4px 2px 12px;
}

.np-dr-title {
  font-weight: 700;
  font-size: 16px;
}

.np-dr-count {
  font-size: 13px;
  color: var(--th-fg-8b8b98);
  font-variant-numeric: tabular-nums;
}

.np-dr-sub {
  font-size: 13px;
  line-height: 1.45;
  color: var(--th-fg-8b8b98);
  margin: -6px 2px 12px;
}

.np-dr-new {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: var(--th-bg-f1f1f5);
  color: var(--th-fg-18181b);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 15px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.np-dr-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.np-dr-tile {
  position: relative;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.np-dr-mini {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  border: .5px solid var(--th-line-e4e4ec);
  overflow: hidden;
  background: var(--th-bg-f1f1f5);
  transition: transform .15s, box-shadow .15s;
}

.np-dr-tile:active .np-dr-mini { transform: scale(.96); }

/* The page is drawn at its real 360x640 size, then scaled to the tile */
.np-dr-page {
  position: absolute;
  left: 0;
  top: 0;
  width: 360px;
  height: 640px;
  transform-origin: top left;
}

.np-dr-page img {
  position: absolute;
  object-fit: contain;
  pointer-events: none;
}

.np-dr-age {
  display: block;
  font-size: 11px;
  color: var(--th-fg-8b8b98);
  margin-top: 4px;
}

.np-dr-hint {
  font-size: 12px;
  color: var(--th-fg-8b8b98);
  text-align: center;
  margin: 14px 0 0;
}

/* "Drafts are full": pick one to delete */
.np-dr-tile.np-dr-pick .np-dr-mini {
  box-shadow: 0 0 0 3px #dc2626;
  transform: scale(.96);
}

.np-dr-tile.np-dr-pick .np-dr-mini::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(220, 38, 38, .25);
}

.np-dr-x {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dc2626;
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.np-dr-tile.np-dr-pick .np-dr-x { display: flex; }

.np-dr-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.np-dr-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 13px;
  cursor: pointer;
}

.np-dr-btn-go { background: linear-gradient(to top right, #6D28D9, #14B8A6); color: #ffffff; }
.np-dr-btn-go[aria-disabled="true"] { background: #cfc8e6; }
.np-dr-btn-del { background: #dc2626; color: #ffffff; }
.np-dr-btn-soft { background: var(--th-bg-f1f1f5); color: var(--th-fg-18181b); }

/* Delete prompt */
.np-dr-confirm {
  text-align: center;
  padding: 18px 16px 104px;
}

.np-dr-confirm .np-dr-mini {
  width: 72px;
  margin: 0 auto;
}

.np-dr-confirm h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 10px 0 4px;
}

.np-dr-confirm p {
  font-size: 13px;
  color: var(--th-fg-8b8b98);
  margin: 0 0 8px;
}

@keyframes npDrUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes npDrFade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .np-dr-sheet, .np-dr-dim { animation: none; }
}
