/* /public/css/news-reader.css
   🗞️ The newspaper reading table (Hearthside Library, step 1): js/news-reader.js
   A lamp-lit wooden reading table. The same look in light and dark mode (paper reads best on dark wood). */

.nr {
  position: fixed; inset: 0; z-index: 1085;
  display: grid; grid-template-rows: auto 1fr auto;
  color: #f6efe2; font-family: var(--bs-body-font-family);
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255, 206, 140, .20), transparent 70%),
    repeating-linear-gradient(92deg, rgba(0,0,0,.06) 0 2px, transparent 2px 9px, rgba(255,255,255,.025) 9px 11px, transparent 11px 23px),
    linear-gradient(180deg, #4a3423, #2f2016 85%);
  animation: nr-in .28s ease-out;
}
@keyframes nr-in { from { opacity: 0; transform: scale(.985); } }

/* top bar */
.nr-top { display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem; background: rgba(20, 13, 8, .55); border-bottom: 1px solid rgba(255, 220, 170, .12); }
.nr-title { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.nr-title b { display: block; font-family: "Lora", Georgia, serif; font-size: 1.25rem; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-title small { display: block; color: #d9c9ae; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-tools { display: flex; gap: .4rem; }
.nr-btn {
  min-height: 44px; padding: .4rem .85rem; border-radius: 12px; border: 1px solid rgba(255, 220, 170, .22);
  background: rgba(255, 245, 230, .08); color: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .35rem; transition: background .15s;
}
.nr-btn:hover { background: rgba(255, 245, 230, .16); }
.nr-gold, .nr-btn.nr-gold { background: linear-gradient(180deg, #e7b75a, #c9922f); color: #2b1a08; border-color: #f1c873; }
.nr-gold:hover { background: linear-gradient(180deg, #f0c56c, #d39d39); }
.nr-btn.is-on { box-shadow: 0 0 0 3px rgba(241, 200, 115, .55); }
.nr-count:not(:empty) { font-style: normal; background: #f1c873; color: #2b1a08; border-radius: 99px; padding: 0 .45rem; font-size: .8rem; }

/* stage */
.nr-body { display: grid; grid-template-columns: 1fr; min-height: 0; }
.nr.has-side .nr-body { grid-template-columns: 1fr minmax(320px, 380px); }
.nr-stage { position: relative; overflow: hidden; min-height: 0; touch-action: none; user-select: none; }
.nr-view { position: absolute; inset: 0; display: grid; place-items: center; }
.nr-spread { position: relative; display: flex; perspective: 2400px; filter: drop-shadow(0 18px 30px rgba(0,0,0,.55)); }
.nr-spread.is-two .nr-page:first-child { box-shadow: inset -18px 0 22px -16px rgba(60, 40, 15, .45); }
.nr-spread.is-two .nr-page:last-child { box-shadow: inset 18px 0 22px -16px rgba(60, 40, 15, .45); }
.nr-page { position: relative; background: #f4ecd8; cursor: zoom-in; }
.nr-page img, .nr-sheet img { width: 100%; height: 100%; display: block; filter: sepia(.06); pointer-events: none; }
.nr-sheet img { filter: none; image-rendering: auto; }
.nr-pno { position: absolute; bottom: -1.7rem; left: 50%; transform: translateX(-50%); font-size: .8rem; color: #d9c9ae; }
.nr-out-l { animation: nr-out-l .26s ease-in forwards; }
.nr-out-r { animation: nr-out-r .26s ease-in forwards; }
@keyframes nr-out-l { to { transform: translateX(-12%) rotateY(14deg); opacity: 0; } }
@keyframes nr-out-r { to { transform: translateX(12%) rotateY(-14deg); opacity: 0; } }

/* the page turn: a leaf swings over the fold */
.nr-leaf { position: absolute; top: 0; transform-style: preserve-3d; z-index: 3; animation: .75s cubic-bezier(.45, .05, .3, 1) forwards; }
.nr-leaf.is-fwd { right: 0; transform-origin: left center; animation-name: nr-flip-fwd; }
.nr-leaf.is-back { left: 0; transform-origin: right center; animation-name: nr-flip-back; }
@keyframes nr-flip-fwd { to { transform: rotateY(-180deg); } }
@keyframes nr-flip-back { to { transform: rotateY(180deg); } }
.nr-face { position: absolute; inset: 0; backface-visibility: hidden; background: #f4ecd8; overflow: hidden; }
.nr-face img { width: 100%; height: 100%; display: block; filter: sepia(.06); }
.nr-face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.18), transparent 30%, transparent 70%, rgba(0,0,0,.12)); }
.nr-face.is-backside { transform: rotateY(180deg); }

/* one page up close */
.nr-focus { position: absolute; inset: 0; cursor: grab; }
.nr-focus:active { cursor: grabbing; }
.nr.is-clipping .nr-focus { cursor: crosshair; }
.nr-sheet { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #f4ecd8; box-shadow: 0 18px 40px rgba(0,0,0,.55); }
.nr-sheet.nr-anim { transition: transform .6s cubic-bezier(.3, .7, .2, 1), width .6s cubic-bezier(.3, .7, .2, 1), height .6s cubic-bezier(.3, .7, .2, 1); }
.nr-boxes { position: absolute; inset: 0; }
.nr-draw { position: absolute; border: 3px dashed #c9922f; background: rgba(241, 200, 115, .18); border-radius: 4px; pointer-events: none; }

/* family stories on the page: a warm gold glow with a name tag */
.nr-box {
  position: absolute; padding: 0; border: 2px solid rgba(214, 160, 50, .95); border-radius: 4px; cursor: pointer;
  background: rgba(241, 200, 115, .12); box-shadow: 0 0 0 3px rgba(241, 200, 115, .28), 0 0 18px rgba(241, 190, 90, .45);
  animation: nr-glow 3.2s ease-in-out infinite;
}
.nr-box:hover, .nr-box.is-on { background: rgba(241, 200, 115, .06); box-shadow: 0 0 0 4px rgba(241, 200, 115, .6), 0 0 26px rgba(241, 190, 90, .7); animation: none; }
.nr.is-clipping .nr-box { pointer-events: none; opacity: .5; }
@keyframes nr-glow { 50% { box-shadow: 0 0 0 5px rgba(241, 200, 115, .18), 0 0 26px rgba(241, 190, 90, .6); } }
.nr-tag {
  position: absolute; left: -2px; bottom: 100%; margin-bottom: 3px; max-width: 260px;
  background: #2b1a08; color: #ffe7b3; border: 1px solid #c9922f; border-radius: 8px;
  font: 700 12px/1.25 var(--bs-body-font-family); padding: 3px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* turn buttons, zoom, hint */
.nr-turn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 56px; height: 96px; border-radius: 16px;
  border: 1px solid rgba(255, 220, 170, .25); background: rgba(20, 13, 8, .55); color: #ffe7b3; font-size: 2.4rem; line-height: 1; cursor: pointer;
}
.nr-turn:hover:not(:disabled) { background: rgba(20, 13, 8, .8); }
.nr-turn:disabled { opacity: .25; cursor: default; }
.nr-turn.is-prev { left: 14px; } .nr-turn.is-next { right: 14px; }
.nr-zoom { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: flex; gap: 6px; }
.nr-zoom button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid rgba(255, 220, 170, .25); background: rgba(20, 13, 8, .7); color: #ffe7b3; font-size: 1.4rem; font-weight: 700; cursor: pointer; }
.nr-tobook { display: none; }
.is-focus .nr-tobook { display: block; }
.nr-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4; background: rgba(20, 13, 8, .65); color: #ffe7b3; padding: .3rem .8rem; border-radius: 99px; font-size: .85rem; pointer-events: none; white-space: nowrap; }

/* page strip */
.nr-strip { display: flex; gap: 10px; padding: .55rem .9rem .7rem; overflow-x: auto; background: rgba(20, 13, 8, .55); border-top: 1px solid rgba(255, 220, 170, .12); justify-content: safe center; }
.nr-thumb { position: relative; flex: 0 0 auto; width: 54px; padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; cursor: pointer; color: #d9c9ae; }
.nr-thumb img { width: 100%; aspect-ratio: 1 / 1.45; object-fit: cover; object-position: top; border-radius: 4px; display: block; background: #f4ecd8; }
.nr-thumb span { font-size: .75rem; font-weight: 700; }
.nr-thumb.is-on { border-color: #f1c873; }
.nr-dot { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 99px; background: #f1c873; color: #2b1a08; font-size: .72rem; display: grid; place-items: center; box-shadow: 0 0 0 2px #2f2016; }

/* side panel */
.nr-side { position: relative; overflow-y: auto; padding: 1.1rem 1.1rem 1.5rem; background: #fbf6ec; color: #2b2118; border-left: 1px solid rgba(0,0,0,.25); box-shadow: -10px 0 30px rgba(0,0,0,.35); }
.nr-side-x { position: absolute; top: .55rem; right: .55rem; width: 40px; height: 40px; border-radius: 10px; border: 0; background: rgba(0,0,0,.06); font-size: 1.1rem; cursor: pointer; color: inherit; }
.nr-h { font-family: "Lora", Georgia, serif; font-size: 1.3rem; font-weight: 700; margin: 0 2.4rem .8rem 0; }
.nr-story-h { font-size: 1.45rem; }
.nr-kicker { margin: 0 0 .25rem; font-weight: 700; color: #8a6420; font-size: .9rem; }
.nr-people { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.nr-people a { background: #efe3c8; color: #4a3210; border-radius: 99px; padding: .35rem .75rem; font-weight: 700; text-decoration: none; }
.nr-read-tools { display: flex; gap: .4rem; margin-bottom: .6rem; }
.nr-read-tools button { min-height: 40px; padding: .3rem .7rem; border-radius: 10px; border: 1px solid #d8c7a4; background: #fff; font-weight: 700; cursor: pointer; color: #2b2118; }
.nr-words { font-family: "Lora", Georgia, serif; line-height: 1.65; white-space: pre-line; background: #fffdf7; border: 1px solid #eadfc6; border-radius: 12px; padding: .9rem 1rem; }
.nr-words p { margin: 0 0 .8em; } .nr-words p:last-child { margin: 0; }
.nr-empty { color: #6b5a44; background: #f3ead8; border-radius: 12px; padding: .8rem 1rem; }
.nr-side-acts { display: grid; gap: .5rem; margin-top: 1rem; }
.nr-big { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .5rem 1rem; border-radius: 12px; border: 1px solid #d8c7a4; background: #fff; color: #2b2118; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; text-align: center; }
.nr-big:hover { background: #fff8ea; color: #2b2118; }
.nr-big.nr-gold { border-color: #c9922f; }
.nr-danger { color: #a3261c; border-color: #e3b7b1; }
.nr-link { background: none; border: 0; color: #6b4aa8; font-weight: 700; padding: .4rem; cursor: pointer; }
.nr-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .45rem; }
.nr-list button { width: 100%; display: flex; gap: .7rem; align-items: center; text-align: left; padding: .65rem .8rem; border-radius: 12px; border: 1px solid #eadfc6; background: #fffdf7; cursor: pointer; color: inherit; }
.nr-list button:hover { border-color: #c9922f; }
.nr-li-ico { font-size: 1.5rem; }
.nr-list b { display: block; } .nr-list small { color: #6b5a44; }
.nr-dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin-bottom: 1rem; }
.nr-dl dt { color: #6b5a44; font-weight: 600; } .nr-dl dd { margin: 0; font-weight: 700; }
.nr-cite { font-size: .9rem; color: #4d3f2f; background: #f3ead8; border-radius: 10px; padding: .6rem .8rem; margin: .8rem 0; }

/* clip form */
.nr-q { display: block; font-weight: 700; margin: .9rem 0 .4rem; }
.nr-q small { font-weight: 500; color: #6b5a44; }
.nr-kinds, .nr-topics { display: flex; flex-wrap: wrap; gap: .4rem; }
.nr-kinds button, .nr-topics button { min-height: 44px; padding: .35rem .8rem; border-radius: 12px; border: 1px solid #d8c7a4; background: #fff; font-weight: 700; cursor: pointer; color: #2b2118; }
.nr-topics { margin-top: .5rem; } .nr-topics button { min-height: 38px; font-size: .88rem; }
.nr-kinds button.on, .nr-topics button.on { background: #f1c873; border-color: #c9922f; }
.nr-input { width: 100%; min-height: 46px; padding: .5rem .75rem; border: 1px solid #d8c7a4; border-radius: 12px; font-size: 1rem; background: #fff; color: #2b2118; }
.nr-ta { min-height: 140px; font-family: "Lora", Georgia, serif; }
.nr-chosen { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .4rem; }
.nr-chosen span { background: #efe3c8; border-radius: 99px; padding: .25rem .3rem .25rem .7rem; font-weight: 700; }
.nr-chosen button { border: 0; background: none; font-size: 1.1rem; cursor: pointer; padding: 0 .35rem; }
.nr-results { list-style: none; padding: 0; margin: .3rem 0 0; border: 1px solid #eadfc6; border-radius: 12px; overflow: hidden; }
.nr-results button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid #f0e7d4; background: #fff; padding: .55rem .8rem; cursor: pointer; color: inherit; }
.nr-results button:hover { background: #fff8ea; }
.nr-results small { color: #6b5a44; }
.nr-msg { margin: .6rem 0 0; color: #a3261c; font-weight: 700; }

/* phones: one page at a time, the panel slides up from the bottom */
@media (max-width: 859px) {
  .nr-top { gap: .4rem; padding: .45rem .55rem; }
  .nr-btn span, .nr-back span { display: none; }
  .nr-title b { font-size: 1.05rem; }
  .nr-turn { width: 42px; height: 72px; font-size: 1.9rem; }
  .nr-turn.is-prev { left: 6px; } .nr-turn.is-next { right: 6px; }
  .nr.has-side .nr-body { grid-template-columns: 1fr; grid-template-rows: 1fr minmax(0, 52%); }
  .nr-side { border-left: 0; border-top: 1px solid rgba(0,0,0,.25); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.35); }
  .nr-strip { justify-content: flex-start; }
  .nr-tag { font-size: 11px; max-width: 170px; }
  .nr-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { .nr, .nr-box { animation: none; } .nr-sheet.nr-anim { transition: none; } }

/* the "Add a whole newspaper" window */
.ni { position: fixed; inset: 0; z-index: 1090; background: rgba(20, 12, 6, .6); display: grid; place-items: center; padding: 1rem; overflow-y: auto; }
.ni-card { position: relative; width: min(680px, 100%); background: #fbf6ec; color: #2b2118; border-radius: 20px; padding: 1.4rem 1.4rem 1.2rem; box-shadow: 0 30px 70px rgba(0,0,0,.45); }
.ni-card h2 { font-family: "Lora", Georgia, serif; font-size: 1.5rem; margin: 0 2.5rem .5rem 0; }
.ni-x { position: absolute; top: .7rem; right: .7rem; width: 42px; height: 42px; border-radius: 12px; border: 0; background: rgba(0,0,0,.06); font-size: 1.1rem; cursor: pointer; color: inherit; }
.ni-lead { color: #4d3f2f; }
.ni-drop { display: grid; justify-items: center; gap: .2rem; padding: 1.1rem; border: 2px dashed #c9a96a; border-radius: 16px; background: #fffdf7; cursor: pointer; text-align: center; }
.ni-drop:hover { background: #fff8ea; }
.ni-drop-ico { font-size: 2rem; } .ni-drop small { color: #6b5a44; }
.ni-files { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; gap: .35rem; max-height: 230px; overflow-y: auto; }
.ni-files li { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid #eadfc6; border-radius: 10px; padding: .35rem .5rem; }
.ni-files li span { font-weight: 800; color: #8a6420; min-width: 4.2em; }
.ni-files li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ni-files li small { color: #6b5a44; }
.ni-files button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid #e2d5b9; background: #fff; cursor: pointer; color: inherit; }
.ni-files button:disabled { opacity: .3; }
.ni-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1rem; margin-top: 1rem; }
.ni-grid label { font-weight: 700; display: grid; gap: .3rem; }
.ni-grid label small { font-weight: 500; color: #6b5a44; }
.ni-wide { grid-column: 1 / -1; }
.ni-msg { min-height: 1.5em; margin: .8rem 0 0; font-weight: 700; color: #6b4aa8; }
.ni-foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .6rem; }
@media (max-width: 600px) { .ni-grid { grid-template-columns: 1fr; } .ni-foot { flex-direction: column-reverse; } }

/* pictures on document cards and paper trails */
.nr-cov-issue { position: relative; display: block; width: 100%; height: 100%; }
.nr-cov-issue img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.nr-cov-n { position: absolute; right: 6px; bottom: 6px; background: rgba(43, 26, 8, .85); color: #ffe7b3; font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.nr-cov-crop { position: relative; display: block; width: 100%; max-height: 100%; overflow: hidden; background: #f4ecd8; }
.nr-cov-crop img { position: absolute; max-width: none; height: auto; filter: sepia(.06); }
