/* Family Gift List -- a parchment Christmas scroll on a winter-night sky. */
:root {
  --sky-top: #0a1c26;
  --sky-mid: #0f3331;
  --sky-low: #1b4d40;
  --paper: #fbf2dc;
  --paper-edge: rgba(150, 108, 52, .22);
  --ink: #3a2a1b;
  --ink-soft: #8a745a;
  --rule: #dcc9a2;
  --red: #b3262c;
  --green: #1c6b4a;
  --wood-1: #f0d9a8;
  --wood-2: #c79d5e;
  --wood-3: #8a6233;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--sky-low); }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 100%) fixed;
  font: 17px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #e0a020; outline-offset: 2px; }

main { position: relative; z-index: 1; padding: 22px 26px 150px; }

/* ---------- the scroll ---------- */
.scroll { max-width: 620px; margin: 0 auto; }
.roll {
  position: relative; z-index: 1; height: 34px; margin: 0 -16px; border-radius: 17px;
  background: linear-gradient(180deg, var(--wood-1) 0%, var(--wood-2) 48%, var(--wood-3) 100%);
  box-shadow: 0 8px 14px -6px rgba(0, 0, 0, .55);
}
.roll::before, .roll::after {
  content: ""; position: absolute; top: 5px; width: 12px; height: 24px; border-radius: 6px;
  background: linear-gradient(180deg, #a87c45, #6a4821);
}
.roll::before { left: -7px; }
.roll::after { right: -7px; }
.paper {
  margin: -6px 0; padding: 34px 30px 30px;
  background:
    linear-gradient(90deg, var(--paper-edge), transparent 7%, transparent 93%, var(--paper-edge)),
    var(--paper);
  box-shadow: 0 0 30px rgba(0, 0, 0, .35);
}

header { text-align: center; }
h1 {
  margin: 0; font: 700 2.9rem/1 "Caveat", "Segoe Script", cursive; color: var(--red);
}
.countdown {
  display: inline-block; margin: 14px 0 0; padding: 3px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 700; color: var(--green);
  border: 1.5px dashed var(--green);
}
.countdown:empty { display: none; }
.who { margin: 12px 0 0; font-size: .95rem; font-weight: 700; }
.who button {
  background: none; border: 0; padding: 2px 4px; font-weight: 600; font-size: .88rem;
  color: var(--ink-soft); text-decoration: underline;
}
.chooser { text-align: center; margin-top: 26px; }
.chooser h2 { display: block; border: 0; font-size: 2.6rem; }
.chooser p { margin: 4px 0 18px; color: var(--ink-soft); font-size: .95rem; }
.chooser .names { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.chooser .names button {
  min-height: 60px; border-radius: 14px; border: 2px solid var(--red); background: rgba(255, 255, 255, .55);
  font: 700 1.9rem/1 "Caveat", cursive; color: var(--red);
}
.chooser .names button:hover { background: var(--red); color: #fff; }
.newperson { margin-top: 34px; text-align: center; }
.newperson .add { margin-top: 0; }
.newperson-open {
  padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: .92rem;
  color: var(--green); background: none; border: 1.5px dashed var(--green);
}
.newperson-open:hover { background: rgba(28, 107, 74, .1); }
.peek {
  margin: 8px 0 2px; padding: 8px 12px; border-radius: 10px; font-size: .88rem;
  color: var(--green); background: rgba(28, 107, 74, .1);
}
.gift.plain { cursor: default; }
.gift.plain:hover { background: none; }
.bullet { flex: none; width: 26px; text-align: center; }
.how { margin: 14px 0 0; font-size: .9rem; color: var(--ink-soft); }
.loading { text-align: center; color: var(--ink-soft); padding: 30px 0; }
.sign { text-align: center; margin: 34px 0 0; font: 700 1.7rem/1 "Caveat", cursive; color: var(--green); }

/* ---------- one person ---------- */
.person { margin-top: 30px; }
h2 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 0 4px; padding-bottom: 2px; border-bottom: 2px solid var(--red);
  font: 700 2.2rem/1.1 "Caveat", "Segoe Script", cursive; color: var(--red);
}
h2 .count { font: 600 .78rem/1 "Plus Jakarta Sans", system-ui, sans-serif; color: var(--ink-soft); }

ul.gifts { list-style: none; margin: 0; padding: 0; }
ul.gifts li { display: flex; align-items: center; gap: 4px; border-bottom: 1px dashed var(--rule); }
ul.gifts li.none { padding: 12px 2px; color: var(--ink-soft); font-style: italic; font-size: .92rem; }

.gift {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 11px 2px; background: none; border: 0; text-align: left; border-radius: 8px;
}
.gift:hover { background: rgba(150, 108, 52, .09); }
.box {
  flex: none; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--ink-soft);
  display: grid; place-items: center; font-size: 1rem; font-weight: 800; color: #fff; line-height: 1;
}
.title { font-size: 1.08rem; font-weight: 600; overflow-wrap: anywhere; }
.bought .box { background: var(--green); border-color: var(--green); }
.bought .title {
  color: var(--ink-soft); font-weight: 500;
  text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px;
}

.link, .remove {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 10px; text-decoration: none; background: none; border: 0;
}
.link { font-size: 1.05rem; }
.remove { font-size: 1.5rem; line-height: 1; color: var(--ink-soft); opacity: .55; }
.link:hover, .remove:hover { background: rgba(150, 108, 52, .14); opacity: 1; }
.remove:hover { color: var(--red); }

/* ---------- add a gift ---------- */
.add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* the link box appears once you start on a gift */
.add .add-link { display: none; flex: 1 1 100%; font-size: .92rem; }
.add:focus-within .add-link, .add .add-link:not(:placeholder-shown) { display: block; }
.editlink {
  flex: none; height: 32px; padding: 0 9px; border-radius: 999px; white-space: nowrap;
  font-size: .78rem; font-weight: 700; color: var(--green);
  background: none; border: 1.5px dashed var(--rule);
}
.editlink:hover { border-color: var(--green); background: rgba(28, 107, 74, .08); }
.editlink.has { border: 0; padding: 0; width: 30px; font-size: .95rem; color: var(--ink-soft); opacity: .6; }
.editlink.has:hover { opacity: 1; }
.add input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--rule); background: rgba(255, 255, 255, .6);
}
.add input::placeholder { color: var(--ink-soft); opacity: .85; }
.add input:focus { outline: none; border-color: var(--green); background: #fff; }
.add button {
  flex: none; padding: 0 20px; min-height: 46px; border-radius: 12px; border: 0;
  font-weight: 700; color: #fff; background: var(--green);
}
.add button:hover { filter: brightness(1.1); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 3;
  background: #fff; color: #14211d; font-weight: 600; padding: 12px 20px; border-radius: 14px;
  max-width: calc(100vw - 32px); box-shadow: 0 12px 32px rgba(0, 0, 0, .4);
}

/* ---------- Christmas trimmings ---------- */
.lights {
  display: flex; justify-content: space-around; height: 24px; overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, .22); position: relative; z-index: 1; margin-top: 10px;
}
.lights i {
  width: 9px; height: 12px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: currentColor; box-shadow: 0 0 14px 3px currentColor;
  animation: twinkle 1.6s ease-in-out infinite alternate;
}
.lights i:nth-child(4n+1) { color: #ff5f56; }
.lights i:nth-child(4n+2) { color: #ffc940; animation-delay: .4s; }
.lights i:nth-child(4n+3) { color: #4fd68a; animation-delay: .8s; }
.lights i:nth-child(4n)   { color: #5fb2ff; animation-delay: 1.2s; }
@keyframes twinkle { from { opacity: .3; } to { opacity: 1; } }

#snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
#snow span { position: absolute; top: -2em; color: #fff; opacity: .55; animation: fall linear infinite; }
@keyframes fall { to { transform: translate3d(var(--drift), 105vh, 0) rotate(360deg); } }

.ground {
  position: fixed; left: 0; right: 0; bottom: 0; height: 44px; z-index: 0; pointer-events: none;
  display: flex; justify-content: space-between; align-items: flex-end; padding: 0 10px;
  background:
    radial-gradient(60px 26px at 12% 100%, #fff 98%, transparent),
    radial-gradient(90px 34px at 38% 100%, #fff 98%, transparent),
    radial-gradient(70px 28px at 66% 100%, #fff 98%, transparent),
    radial-gradient(100px 36px at 90% 100%, #fff 98%, transparent),
    linear-gradient(transparent 55%, #fff 55%);
}
.ground span { font-size: 3.2rem; line-height: 1; margin-bottom: 10px; letter-spacing: -.1em; }

@media (prefers-reduced-motion: reduce) {
  #snow { display: none; }
  .lights i { animation: none; }
}
@media (max-width: 520px) {
  main { padding: 18px 22px 140px; }
  .paper { padding: 28px 18px 26px; }
  h1 { font-size: 2.4rem; }
  h2 { font-size: 2rem; }
}
