/* natdrop — pillar-box red on paper white; waybill mono for metadata. */

:root {
  --paper: #faf9f7;
  --card: #ffffff;
  --ink: #23201d;
  --muted: #85807a;
  --line: #e7e3dd;
  --red: #b3202e;
  --red-deep: #8f1a25;
  --slot-dark: #2b2320;
  --ok: #2f7d4f;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(35, 32, 29, 0.06), 0 4px 14px rgba(35, 32, 29, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191715;
    --card: #221f1d;
    --ink: #ece8e3;
    --muted: #938d86;
    --line: #35312d;
    --red: #d4293a;
    --red-deep: #a91f2d;
    --slot-dark: #0d0b0a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  padding-bottom: 90px;
  -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 10px;
}
.wordmark {
  font-weight: 800; font-size: 22px; letter-spacing: -0.03em;
  user-select: none;
}
.wordmark .dot { color: var(--red); }
#syncDot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); opacity: .5; margin-top: 4px;
  transition: background .3s, opacity .3s;
}
#syncDot.live { background: var(--ok); opacity: 1; }
header .spacer { flex: 1; }
.iconbtn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 8px; border-radius: 8px; font-size: 18px; line-height: 1;
}
.iconbtn:hover { color: var(--ink); background: var(--line); }

/* ---------- the slot ---------- */
#slot {
  position: relative;
  background: var(--slot-dark);
  border-radius: 16px;
  padding: 26px 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: 0; width: 100%;
  display: block;
}
#slot .aperture {
  height: 14px; border-radius: 7px;
  background: var(--paper);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.45);
  transition: box-shadow .25s, background .25s;
  pointer-events: none;
}
#slot .hint {
  text-align: center; color: rgba(255,255,255,.55);
  font-size: 13px; margin-top: 14px; pointer-events: none;
  font-family: var(--mono); letter-spacing: .02em;
}
#slot.hot .aperture { background: #ffd9dd; box-shadow: inset 0 2px 6px rgba(0,0,0,.45), 0 0 0 3px var(--red); }
#slot.hot { outline: 2px solid var(--red); outline-offset: 2px; }
#slot:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

/* ---------- action row ---------- */
.actions {
  display: flex; gap: 10px; margin: 14px 0 6px;
}
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: var(--radius); padding: 12px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: var(--sans);
}
.btn:active { transform: scale(.98); }
.btn.primary {
  background: var(--red); border-color: var(--red); color: #fff; flex: 1;
}
.btn.primary:hover { background: var(--red-deep); }
.btn:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

#noteBox { display: none; margin-top: 10px; }
#noteBox.open { display: block; }
#noteInput {
  width: 100%; min-height: 84px; resize: vertical;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  font: 15px/1.5 var(--sans); padding: 12px;
}
#noteBox .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---------- sections ---------- */
.sectionhead {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 10px;
}
.sectionhead::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sectionhead .pin { color: var(--red); }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; margin-bottom: 10px;
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: no-preference) {
  .card.arriving { animation: post-in .45s cubic-bezier(.2,.9,.3,1); }
  @keyframes post-in {
    from { opacity: 0; transform: translateY(-14px) scaleY(.9); }
    to   { opacity: 1; transform: none; }
  }
}
.card .meta {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.card .meta .status-uploading { color: var(--red); }
.card .meta .status-failed { color: var(--red); font-weight: 700; }
.card .text-body {
  white-space: pre-wrap; font-size: 15px; max-height: 7.5em; overflow: hidden;
  cursor: pointer;
}
.card .text-body.expanded { max-height: none; }
.card .thumbwrap {
  cursor: pointer;
  max-height: 400px; overflow: hidden; border-radius: 6px;
}
.card .thumbwrap img {
  width: 100%; height: auto; display: block;
  background: var(--line);
}
.card .filebadge { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.card .filebadge .ext {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  background: var(--slot-dark); color: #fff; border-radius: 6px;
  padding: 6px 8px; letter-spacing: .05em; min-width: 40px; text-align: center;
}
.card .progress {
  height: 4px; background: var(--line); border-radius: 2px; margin-top: 10px; overflow: hidden;
}
.card .progress i { display: block; height: 100%; background: var(--red); width: 0; transition: width .3s; }

.card .cardactions { display: flex; gap: 2px; margin-top: 8px; align-items: center; }
.cardactions .act {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: 10px; border-radius: 8px; line-height: 0;
}
.cardactions .act svg { width: 20px; height: 20px; display: block; }
.cardactions .act:hover { background: var(--line); color: var(--ink); }
.cardactions .act.copy { color: var(--red); }
.cardactions .act.pinned-on { color: var(--red); }
.cardactions .spacer { flex: 1; }

.empty {
  text-align: center; color: var(--muted); padding: 34px 20px; font-size: 14px;
}
.empty .big { font-size: 15px; color: var(--ink); font-weight: 600; margin-bottom: 6px; }

/* ---------- toast / snackbar ---------- */
#toast, #snackbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  background: var(--slot-dark); color: #fff; border-radius: 10px;
  padding: 12px 18px; font-size: 14px; z-index: 60;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  display: none; align-items: center; gap: 14px;
  max-width: min(92vw, 480px);
}
#toast { bottom: 88px; }
#snackbar { bottom: 24px; }
#toast.show, #snackbar.show { display: flex; }
#snackbar button {
  background: none; border: 0; color: #ff9aa4; font-weight: 700; font-size: 14px; cursor: pointer;
}

/* ---------- drag overlay ---------- */
#dragOverlay {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border: 3px dashed var(--red); border-radius: 18px; margin: 10px;
  pointer-events: none;
}
#dragOverlay.show { display: block; }

/* ---------- lightbox ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.88);
  display: none; align-items: center; justify-content: center; cursor: zoom-out;
}
#lightbox.show { display: flex; }
#lightbox img { max-width: 96vw; max-height: 92vh; }

/* ---------- settings sheet ---------- */
#settings {
  position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.4);
  display: none; align-items: flex-end; justify-content: center;
}
#settings.show { display: flex; }
#settings .sheet {
  background: var(--card); border-radius: 16px 16px 0 0; width: 100%; max-width: 640px;
  padding: 20px 20px 34px;
  max-height: 85dvh; overflow-y: auto;
}
#settings h2 { font-size: 16px; margin: 0 0 14px; }
#settings label { font-size: 13px; color: var(--muted); display: block; margin: 14px 0 4px; }
#settings input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font: 15px var(--sans); padding: 10px;
}
#settings .who { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 16px; }
#settings .row { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- sign-in ---------- */
#gate {
  min-height: 100dvh; display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 26px; padding: 20px;
}
#gate.show { display: flex; }
#gate .mark { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
#gate .mark .dot { color: var(--red); }
#gate p { color: var(--muted); font-size: 14px; margin: 0; text-align: center; }
#gate .btn.primary { flex: 0 0 auto; padding: 14px 26px; font-size: 16px; }

#app { display: none; }
#app.show { display: block; }

@media (min-width: 700px) {
  header { padding-top: 26px; }
  #slot { padding: 30px 24px; }
}
